ws

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 8 Imported by: 0

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 NewHub

func NewHub(d Streamer) *Hub

NewHub creates a hub.

func (*Hub) Serve

func (h *Hub) Serve(ctx context.Context, conn *websocket.Conn)

Serve handles one accepted WebSocket connection until it closes.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL