pub struct BinanceConfig {
pub base_url: String,
pub read_timeout: Duration,
pub initial_reconnect_delay: Duration,
pub max_reconnect_backoff: Duration,
pub max_reconnect_attempts: u32,
pub max_message_size: usize,
pub max_frame_size: usize,
}live-binance only.Expand description
Tunable knobs for a BinanceKlineStream. The defaults match Binance’s
public production endpoint and are right for almost every caller; the
fields exist so an integration test or a Binance Testnet user can point
the stream at a different base URL and shrink the reconnect timing.
Fields§
§base_url: StringWebSocket endpoint without path (e.g. "wss://stream.binance.com:9443").
The combined-stream path /stream?streams=… is appended internally.
read_timeout: DurationMaximum time to wait for the next inbound frame before treating the connection as stalled. Binance pings roughly every 3 minutes, so a healthy but quiet stream stays comfortably inside the 300 s default.
initial_reconnect_delay: DurationDelay before the first reconnect attempt; doubles on each failure up
to Self::max_reconnect_backoff.
max_reconnect_backoff: DurationUpper bound on the exponential reconnect backoff.
max_reconnect_attempts: u32How many times BinanceKlineStream::next_event retries a dropped
connection before surfacing the last error. Must be >= 1.
max_message_size: usizeUpper bound on an inbound WebSocket message. Kline frames are tiny; this only caps a pathological or hostile server from forcing an unbounded allocation.
max_frame_size: usizeUpper bound on a single inbound WebSocket frame.
Trait Implementations§
Source§impl Clone for BinanceConfig
impl Clone for BinanceConfig
Source§fn clone(&self) -> BinanceConfig
fn clone(&self) -> BinanceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more