pub enum ConnectionEvent {
Connecting,
Connected,
Authenticated,
Unauthenticated {
message: String,
},
Disconnected {
code: Option<u16>,
reason: String,
intent: DisconnectIntent,
},
Reconnecting {
attempt: u32,
},
ReconnectFailed {
attempts: u32,
},
HeartbeatTimeout {
elapsed: Duration,
},
Error {
message: String,
code: i32,
},
}Expand description
Events emitted by WebSocket connection.
Consumers attribute events to their source client via the
events() /
state_events()
Receiver they were yielded from — tokio::select! arms naturally
label by source, and code that merges streams from multiple clients
is expected to wrap with its own labeling adapter (3 lines via
tokio_stream::StreamExt::map). The SDK does not pre-empt that
decision by stuffing a label on every event.
Variants§
Connecting
Connection attempt started
Connected
Connection established
Authenticated
Authentication successful
Unauthenticated
Authentication rejected by the server (parallels old SDKs’ unauthenticated event)
Disconnected
Connection closed.
intent classifies the originator: Client
for local-initiated, Server for a
peer Close frame, Network for
transport errors / EOF / heartbeat timeout.
Fields
intent: DisconnectIntentWho initiated the disconnect.
Reconnecting
Reconnection attempt started
ReconnectFailed
Reconnection failed after max attempts
HeartbeatTimeout
Heartbeat timeout: no inbound frame received within the configured
heartbeat_timeout window. Emitted by the dispatch loop when the
read-site timeout fires; the dispatch loop returns immediately
afterwards, which lets the reconnect path take over.
Error
Error occurred
Fields
code: i32Numeric error code (mirrors MarketDataError::to_error_code).
Trait Implementations§
Source§impl Clone for ConnectionEvent
impl Clone for ConnectionEvent
Source§fn clone(&self) -> ConnectionEvent
fn clone(&self) -> ConnectionEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionEvent
impl Debug for ConnectionEvent
Source§impl PartialEq for ConnectionEvent
impl PartialEq for ConnectionEvent
Source§fn eq(&self, other: &ConnectionEvent) -> bool
fn eq(&self, other: &ConnectionEvent) -> bool
self and other values to be equal, and is used by ==.