ws

package
v0.0.0-...-f028939 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventScanProgress    = "scan.progress"
	EventScanComplete    = "scan.complete"
	EventScanError       = "scan.error"
	EventSyncProgress    = "sync.progress"
	EventSyncComplete    = "sync.complete"
	EventMetadataUpdated = "metadata.updated"
	EventTaskStatus      = "task.status"
)

Event types sent over WebSocket.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub manages WebSocket connections and broadcasts events.

func NewHub

func NewHub(log *slog.Logger) *Hub

func (*Hub) Broadcast

func (h *Hub) Broadcast(event string, data any)

Broadcast sends a message to all connected clients.

func (*Hub) ServeHTTP

func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP upgrades the HTTP connection to WebSocket.

type Message

type Message struct {
	Event string `json:"event"`
	Data  any    `json:"data"`
}

Message is the JSON payload sent over WebSocket.

Jump to

Keyboard shortcuts

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