Skip to main content

Module websocket

Module websocket 

Source

Re-exports§

pub use events::now_pair;
pub use events::InvalidationReason;
pub use events::SessionEvent;
pub use events::WsUpdate;
pub use stream::SessionStream;
pub use stream::UpdateStream;
pub use stream::WsDispatcher;
pub use stream::WsDispatcherConfig;

Modules§

events
Multiplexed WebSocket event types.
ndjson
stream
Concrete stream newtypes for the multiplexed WS surface.

Structs§

ActivityFill
ActivityTrade
Activity events still carried inside WsUpdate::Trade / WsUpdate::Fill. Retained as a typed payload alongside the stream rather than as a separate per-token surface.
AtomicWebSocketState
Lock-free atomic wrapper for WebSocketState. O(1) reads without acquiring any async lock.

Enums§

WebSocketState

Constants§

WS_CRYPTO_PING_INTERVAL
WS_MAX_RECONNECT_ATTEMPTS
WS_PING_INTERVAL
Shared WebSocket reconnect/keepalive constants for all exchange implementations.
WS_RECONNECT_BASE_DELAY
WS_RECONNECT_MAX_DELAY
WS_STALL_CHECK_INTERVAL
WS_STALL_TIMEOUT
Force a reconnect if no message has been received for this long. Sized for the quietest live venue: a 50-market Kalshi subscription at ~0.5 msg/s hit a 40s max-quiet window in smoke testing, so 60s was only 33% above observed worst-case. 90s gives ~2× headroom while still shrinking macOS’s ~30-minute silent-death window by ~20×.

Traits§

OrderBookWebSocket
WebSocket driver trait. Surface is deliberately small: connect/disconnect, subscribe/unsubscribe per market, and hand out two multiplexed streams.

Functions§

stall_watchdog
Returns once last_message_at is older than WS_STALL_TIMEOUT.

Type Aliases§

CryptoPriceStream
SportsStream