pub struct ClientConfig {
pub max_frame_size: usize,
pub max_message_size: usize,
pub handshake_timeout: Duration,
pub idle_timeout: Duration,
pub compression: CompressionConfig,
pub tls: Option<TlsConfig>,
pub user_agent: String,
pub origin: Option<String>,
pub protocols: Vec<String>,
pub headers: Vec<(String, String)>,
}Expand description
Client configuration
Fields§
§max_frame_size: usizeMaximum frame size in bytes
max_message_size: usizeMaximum message size in bytes
handshake_timeout: DurationHandshake timeout
idle_timeout: DurationIdle timeout
compression: CompressionConfigCompression configuration
tls: Option<TlsConfig>TLS configuration
user_agent: StringUser agent string
origin: Option<String>Origin header
protocols: Vec<String>WebSocket subprotocols
headers: Vec<(String, String)>Custom headers
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn max_frame_size(self, size: usize) -> Self
pub fn max_frame_size(self, size: usize) -> Self
Set maximum frame size
Sourcepub fn max_message_size(self, size: usize) -> Self
pub fn max_message_size(self, size: usize) -> Self
Set maximum message size
Sourcepub fn handshake_timeout(self, timeout: Duration) -> Self
pub fn handshake_timeout(self, timeout: Duration) -> Self
Set handshake timeout
Sourcepub fn idle_timeout(self, timeout: Duration) -> Self
pub fn idle_timeout(self, timeout: Duration) -> Self
Set idle timeout
Sourcepub fn user_agent(self, agent: String) -> Self
pub fn user_agent(self, agent: String) -> Self
Set user agent
Sourcepub fn add_protocol(self, protocol: String) -> Self
pub fn add_protocol(self, protocol: String) -> Self
Add a subprotocol
Sourcepub fn add_header(self, name: String, value: String) -> Self
pub fn add_header(self, name: String, value: String) -> Self
Add a custom header
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
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 moreSource§impl Debug for ClientConfig
impl Debug for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnwindSafe for ClientConfig
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