pub enum SessionEvent {
Connected,
Reconnected {
gap_ms: u64,
},
Lagged {
dropped: u64,
first_seq: u64,
last_seq: u64,
},
BookInvalidated {
market_id: String,
reason: InvalidationReason,
},
Error {
message: String,
},
}Expand description
Connection-level events, emitted on a channel separate from WsUpdate so
a reconnect is observable as a single global signal rather than per-market.
Variants§
Connected
Initial socket establishment.
Reconnected
Socket re-established after an outage — gap_ms is the wall-clock interval since the last received message.
Lagged
Slow consumer dropped messages — every affected book is invalidated and must be rebuilt from the next Snapshot.
BookInvalidated
A specific market’s book is no longer trustworthy — drop cache and wait for next Snapshot (reasons: Reconnect, Lag, SequenceGap, ExchangeReset).
Error
A non-fatal error observed on the connection (session continues).
Implementations§
Source§impl SessionEvent
impl SessionEvent
Sourcepub fn reconnected(gap: Duration) -> Self
pub fn reconnected(gap: Duration) -> Self
Construct a Reconnected event from a Duration-shaped gap. Saturating
cast at u64::MAX keeps the type stable for callers serializing to JSON.
Sourcepub fn error(err: WebSocketError) -> Self
pub fn error(err: WebSocketError) -> Self
Convenience constructor that stringifies the upstream error.
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more