Documentation
¶
Overview ¶
Package ws implements the WebSocket endpoint that streams real-time data (container stats and logs) to authenticated frontend clients.
A single connection is multiplexed: the client sends "subscribe" messages naming a channel + target, and the server pushes tagged frames back. This lets one dashboard watch many containers over one socket.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub serves WebSocket connections backed by a Streamer.
func (*Hub) Serve ¶
Serve handles one accepted WebSocket connection until it closes. allow gates each subscription by its channel: it is called with the channel name and must return true for the stream to start (the caller maps the channel to an RBAC section and checks the user's live permissions). A nil allow permits all channels (used in tests).
type Streamer ¶
type Streamer interface {
StreamStats(ctx context.Context, hostID int64, id string, emit func(docker.StatsSample)) error
StreamLogs(ctx context.Context, hostID int64, id string, follow bool, tail string, emit func(docker.LogLine)) error
}
Streamer is the subset of the docker manager the hub needs.