pub struct Stream { /* private fields */ }Expand description
WebSocket connection driver.
Stream::new spawns the driver on the current Tokio runtime and returns a
Handle for commands and a receiver of Events.
§Reconnects
After an unexpected disconnect the driver reconnects automatically (see
Config::max_reconnect_attempts) and emits Event::Connected again.
Topics subscribed with Handle::subscribe are restored on every
connection. With Config::credentials the driver first sends auth
(expiry from Config::server_clock) and subscribes only after
Event::Authenticated; a rejected auth is reported as
Event::AuthFailed. Messages sent with Handle::send_command are not
restored.
§Event delivery
Lifecycle events (Connected, Reconnecting, Disconnected) are always
delivered: the driver waits for free space in the event queue. Market and
account data (Message, ParseError) are dropped when the queue is full;
the number of dropped events is reported by Event::Lagged as soon as
there is room again.