pub struct ConnectionConfig {
pub url: String,
pub channel_capacity: usize,
pub reconnect: ReconnectPolicy,
pub ping_interval: Duration,
}Expand description
Configuration for a WebSocket feed connection.
Fields§
§url: StringWebSocket URL to connect to (e.g. "wss://stream.binance.com:9443/ws").
channel_capacity: usizeCapacity of the downstream channel that receives incoming messages.
reconnect: ReconnectPolicyReconnect policy applied on disconnection.
ping_interval: DurationPing interval to keep the connection alive (default: 20 s).
Implementations§
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn new(
url: impl Into<String>,
channel_capacity: usize,
) -> Result<Self, StreamError>
pub fn new( url: impl Into<String>, channel_capacity: usize, ) -> Result<Self, StreamError>
Build a connection configuration for url with the given downstream
channel capacity.
Returns an error if url is empty or channel_capacity is zero.
Sourcepub fn with_reconnect(self, policy: ReconnectPolicy) -> Self
pub fn with_reconnect(self, policy: ReconnectPolicy) -> Self
Override the default reconnect policy.
Sourcepub fn with_ping_interval(self, interval: Duration) -> Self
pub fn with_ping_interval(self, interval: Duration) -> Self
Override the keepalive ping interval (default: 20 s).
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§fn clone(&self) -> ConnectionConfig
fn clone(&self) -> ConnectionConfig
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 ConnectionConfig
impl RefUnwindSafe for ConnectionConfig
impl Send for ConnectionConfig
impl Sync for ConnectionConfig
impl Unpin for ConnectionConfig
impl UnsafeUnpin for ConnectionConfig
impl UnwindSafe for ConnectionConfig
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