Documentation
¶
Overview ¶
Package websocket serves EVE-KILL's live event streams.
Workers publish small envelopes to Redis channels prefixed with ws:. This server subscribes once and fans each event out to browser connections on /ws/*. Killmail streams are topic-routed; comments, status and announcements are broadcast to every connection on their endpoint.
Redis pub/sub is intentionally best-effort. The durable data is already in Postgres, and the feed API has its own sequence-backed recovery path. A relay outage may miss a live notification but must never retry killmail processing.
Index ¶
Constants ¶
const BasePath = "/ws"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
Endpoint is one public WebSocket stream and its Redis pub/sub channel.
Paths are deliberately relative to BasePath. The browser-facing contract is /ws/<path>; keeping the prefix out of every definition prevents a future route move from silently changing the channel or the frame's channel field.
type EndpointStats ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server owns the Redis subscription and every connected WebSocket.
Start and Close are idempotent. A Server may be constructed before Caddy is started, but Start should be called before the handler becomes reachable so the Redis subscription is already attempting to connect.
func (*Server) Close ¶
func (s *Server) Close()
Close stops the subscription and closes active clients.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves only the /ws contract.
There is deliberately no /ws/health or /ws/stats. Process liveness already lives at /health, while operational telemetry is available through Snapshot for later publication into the shared Redis telemetry stream.
type Stats ¶
type Stats struct {
Status string `json:"status"`
Uptime int64 `json:"uptime"`
Timestamp string `json:"timestamp"`
Connections int `json:"connections"`
Redis bool `json:"redis"`
Channels []string `json:"channels"`
Endpoints map[string]EndpointStats `json:"endpoints"`
}
Stats is an internal operational snapshot.
It is intentionally not mounted as a public HTTP endpoint. A later telemetry publisher can put this exact value in Redis alongside Caddy, database and API snapshots for the status page and admin tooling.