Expand description
WebSocket subscriber for the engine’s /ws push surface.
Subscribes to the engine’s broadcast channel, decodes typed
events, and folds them into an EngineState mirror. Handles
reconnection with exponential backoff; the TUI status bar reads
EngineState::connection to render a DEGRADED banner during
partition.
Mirrors ConnectionManager.broadcast() in the engine’s FastAPI
server — event shape is {event: string, ts: iso8601, data: object}.
Unknown event kinds are preserved in EngineEvent::Unknown so
the engine can evolve its push surface without breaking the
subscriber.
Structs§
- Reconnect
Config - Configuration for the subscriber’s reconnect behavior.
- WsSubscriber
- Handle to a running WS subscriber task.
Enums§
- Engine
Event - Typed event the subscriber emits to consumers. Known events are
decoded into strong types; anything else lands in
EngineEvent::Unknownwith the raw payload. - Jitter
Mode - How to jitter an exponential backoff delay before sleeping.
- WsError
- Errors the subscriber can surface to its caller. Reconnectable errors are handled internally via backoff and never bubble out; only construction-time and shutdown errors reach the caller.
Functions§
- apply_
jitter - Apply
modeto a computed backoff cap. - exp_
backoff_ cap - Compute the exponential-backoff cap for a given attempt count
(0-based: attempt 0 uses
initial, attempt 1 usesinitial * multiplier, etc.), clamped tomax.