Documentation
¶
Index ¶
- Variables
- func NewRouter(s *Server) *http.ServeMux
- type GameEntry
- type SSEHandler
- func (h *SSEHandler) Enabled(context.Context, slog.Level) bool
- func (h *SSEHandler) Handle(ctx context.Context, r slog.Record) error
- func (h *SSEHandler) Reset()
- func (h *SSEHandler) Subscribe() ([]string, chan string)
- func (h *SSEHandler) Unsubscribe(ch chan string)
- func (h *SSEHandler) WithAttrs([]slog.Attr) slog.Handler
- func (h *SSEHandler) WithGroup(string) slog.Handler
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultGames = []GameEntry{
{Name: "Stardew Valley", Port: 24642},
{Name: "Terraria", Port: 7777},
{Name: "Factorio", Port: 34197},
{Name: "Minecraft (Bedrock)", Port: 19132},
{Name: "Valheim", Port: 2456},
}
DefaultGames is the list of known games shown in the host form dropdown.
Functions ¶
Types ¶
type SSEHandler ¶ added in v0.2.0
type SSEHandler struct {
// contains filtered or unexported fields
}
SSEHandler is a slog.Handler that broadcasts log lines to SSE subscribers. It also maintains a ring buffer for history replay on new connections.
func NewSSEHandler ¶ added in v0.2.0
func NewSSEHandler(bufferSize int) *SSEHandler
NewSSEHandler creates a new SSE log handler with the given buffer size.
func (*SSEHandler) Reset ¶ added in v0.2.0
func (h *SSEHandler) Reset()
Reset clears the buffer and disconnects all subscribers.
func (*SSEHandler) Subscribe ¶ added in v0.2.0
func (h *SSEHandler) Subscribe() ([]string, chan string)
Subscribe returns buffered history and a channel for new log lines.
func (*SSEHandler) Unsubscribe ¶ added in v0.2.0
func (h *SSEHandler) Unsubscribe(ch chan string)
Unsubscribe removes a subscriber channel.
Click to show internal directories.
Click to hide internal directories.