Expand description
Long-lived WebSocket connector + REST-side handle.
The connector is an actor that owns a single bezant::WsClient and
drives it forever:
- Connect (with exponential-backoff retry).
- Subscribe to
orders+pnl(always, on every connect). - Loop: dispatch frames into per-topic rings, accept subscribe/unsubscribe commands for market data, watch a heartbeat timeout to detect a stalled socket.
- On any disconnect: bump
reset_epoch, push a syntheticgapevent into every active ring, sleep with backoff, GOTO 1.
EventsHandle is what axum handlers get. Cloneable, cheap, exposes
reads against the rings and a command channel into the actor task.
Structs§
- Connector
Cfg - Configurable knobs for the connector.
- Events
Handle - Cloneable handle the axum handlers use. Reads come straight off the shared ring map; writes go through the command channel.
Functions§
- spawn_
connector - Spawn the connector task and return a
EventsHandlefor the axum side. The task owns thebezant::Clientreference (cheap, it’s alreadyArc-wrapped internally) and runs until the binary exits.