pub struct WebSocketConfig {
pub max_message_size: usize,
pub max_frame_size: usize,
pub idle_timeout: Option<Duration>,
pub close_timeout: Duration,
pub send_queue: usize,
}Expand description
Limits and timers for one socket.
Fields§
§max_message_size: usizeThe largest reassembled message that will be accepted.
max_frame_size: usizeThe largest single frame that will be accepted. Checked against the declared length, so an absurd announcement costs no memory.
idle_timeout: Option<Duration>How long a connection may be silent before it is pinged. A second
silent period with no pong closes it. None disables the check.
close_timeout: DurationHow long to wait for the peer’s half of the close handshake.
send_queue: usizeDepth of the outgoing queue. This is the backpressure budget: a client this far behind is dropped.
Implementations§
Source§impl WebSocketConfig
impl WebSocketConfig
Sourcepub fn from_config(config: &Config) -> Self
pub fn from_config(config: &Config) -> Self
Read the limits from the application’s configuration, so an operator can
raise them in .env without recompiling.
websocket.idle_timeout is in seconds; zero turns the check off.
Trait Implementations§
Source§impl Clone for WebSocketConfig
impl Clone for WebSocketConfig
Source§impl Debug for WebSocketConfig
impl Debug for WebSocketConfig
Auto Trait Implementations§
impl Freeze for WebSocketConfig
impl RefUnwindSafe for WebSocketConfig
impl Send for WebSocketConfig
impl Sync for WebSocketConfig
impl Unpin for WebSocketConfig
impl UnsafeUnpin for WebSocketConfig
impl UnwindSafe for WebSocketConfig
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