Skip to main content

Module session

Module session 

Source
Expand description

A background WebSocket session that reconnects and restores its subscriptions.

One session is one connection: public data, or the private streams (logged in with the key). The session sends a heartbeat every 20 seconds as the exchange asks, reconnects when the link breaks or goes silent, logs in again, and sends its subscriptions again. With announce_connects it tells the reader about every connection with WsIncoming::Connected before the restored data, so the reader can tell a reconnect from the first connect.

Structs§

WsOptions
How the session behaves.
WsSession
One WebSocket connection to Bybit, kept alive in a task of its own.

Enums§

WsStream
Which stream the session connects to.

Constants§

DEFAULT_RECONNECT_MAX
The longest pause before a reconnect.
DEFAULT_RECONNECT_MIN
The first pause before a reconnect.
HEARTBEAT_INTERVAL
The heartbeat the exchange asks for.
SILENCE_LIMIT
Without any frame (a heartbeat answer counts) for this long the link is taken for dead.