SessionEvent is delivered via ws.session_events() — separate from
updates() so a single reconnect is one event, not one per subscribed market.
Connected
Initial socket establishment. Fires once per call to connect().
Reconnected
Socket re-established after an observed outage.
| Field | Type |
|---|---|
gap_ms | u64 — wall-clock gap between last received message and recovery |
WsUpdate::Snapshot events on each subscribed market.
Lagged
The outbound dispatch channel overflowed: a slow consumer missed deltas.
OpenPX raises this explicitly rather than silently skipping (the way
tokio::sync::broadcast would).
| Field | Type |
|---|---|
dropped | u64 |
first_seq | u64 |
last_seq | u64 |
Lagged event is followed by a BookInvalidated { reason: Lag } for every
affected market.
BookInvalidated
A specific market’s book is no longer trustworthy. Discard your cache for
that market_id; the next WsUpdate::Snapshot will rebuild it.
| Field | Type |
|---|---|
market_id | string |
reason | InvalidationReason |
InvalidationReason: Reconnect, Lag, SequenceGap { expected, received },
ExchangeReset.
Error
A non-fatal error observed on the connection. The session continues; surface
this for logging or alerting.
| Field | Type |
|---|---|
message | string |