pub struct WsConnectionConfig {
pub url: String,
pub max_retries: usize,
pub initial_backoff_ms: u64,
pub max_backoff_ms: u64,
pub ping_interval_secs: u64,
pub auto_reconnect: bool,
}Expand description
Configuration for websocket connection with retry logic
Fields§
§url: StringBase URL for the websocket connection
max_retries: usizeMaximum retry attempts for initial connection and reconnections (default: 20)
initial_backoff_ms: u64Initial backoff delay in milliseconds (default: 100ms)
max_backoff_ms: u64Maximum backoff delay in milliseconds (default: 10s)
ping_interval_secs: u64Ping interval in seconds (default: 5s). Set to 0 to disable automatic pings.
auto_reconnect: boolAuto-reconnect on connection loss (default: true)
Implementations§
Source§impl WsConnectionConfig
impl WsConnectionConfig
pub fn new(url: impl Into<String>) -> Self
pub fn with_retries(self, max_retries: usize) -> Self
pub fn with_backoff(self, initial_ms: u64, max_ms: u64) -> Self
pub fn with_ping_interval(self, ping_interval_secs: u64) -> Self
pub fn with_auto_reconnect(self, auto_reconnect: bool) -> Self
Trait Implementations§
Source§impl Clone for WsConnectionConfig
impl Clone for WsConnectionConfig
Source§fn clone(&self) -> WsConnectionConfig
fn clone(&self) -> WsConnectionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WsConnectionConfig
impl RefUnwindSafe for WsConnectionConfig
impl Send for WsConnectionConfig
impl Sync for WsConnectionConfig
impl Unpin for WsConnectionConfig
impl UnwindSafe for WsConnectionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more