pub struct WsOptions {
pub announce_connects: bool,
pub reconnect_min: Duration,
pub reconnect_max: Duration,
}Expand description
Options of a WebSocket session.
The default is no announcement, a first pause of 500 ms and an upper bound of 30 s.
§Examples
use std::time::Duration;
use brokapi_bcs_protocol::ws::session::WsOptions;
let options = WsOptions { announce_connects: true, ..WsOptions::default() };
assert_eq!(options.reconnect_min, Duration::from_millis(500));
assert_eq!(options.reconnect_max, Duration::from_secs(30));Fields§
§announce_connects: boolSend IncomingMessage::Reconnected to the reader at every connect, before the subscriptions
are restored (also at the first connect).
That is how the reader learns about a lost link in the same stream as the data. Count the markers: from the second on, the connection was lost, and what came before is not continued by what follows. For order events this means: ask for the state of your open orders again.
reconnect_min: DurationPause before the first reconnect attempt. It doubles after each failed attempt up to
reconnect_max. Values below 10 ms are raised to 10 ms.
reconnect_max: DurationUpper bound of the pause. The pause returns to reconnect_min once a connection has lived
10 seconds. A value below reconnect_min is raised to it.