Documentation
¶
Overview ¶
Package ws implements a Server-Sent Events (SSE) hub for real-time event broadcasting to connected web clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedactSecrets ¶
RedactSecrets replaces known secret patterns in a string with "***".
Types ¶
type EventWriter ¶
EventWriter persists SSE events for later retrieval.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages SSE subscribers and broadcasts events. It implements agent.EventPublisher so it can be wired into AgentService.
func (*Hub) ClientCount ¶
ClientCount returns the number of active SSE connections.
func (*Hub) Publish ¶
Publish implements agent.EventPublisher. Data is redacted before broadcast to prevent secrets from leaking to the UI. If an EventWriter is attached, the event is also persisted to disk.
func (*Hub) ServeHTTP ¶
func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves an SSE stream to a single client.
func (*Hub) SetWriter ¶
func (h *Hub) SetWriter(w EventWriter)
SetWriter attaches an EventWriter for persisting broadcast events.