Skip to main content

specter/websocket/
mod.rs

1//! RFC 6455 WebSocket client support.
2
3mod client;
4mod connection;
5mod error;
6mod frame;
7mod handshake;
8mod message;
9
10use std::time::Duration;
11
12pub use client::WebSocketBuilder;
13pub(crate) use client::WebSocketClientParts;
14pub use connection::WebSocket;
15pub use error::{WebSocketError, WebSocketResult};
16pub use message::{CloseCode, CloseFrame, Message};
17
18/// WebSocket frame/message limits and idle timeouts.
19#[derive(Debug, Clone)]
20pub struct WebSocketConfig {
21    pub max_frame_size: usize,
22    pub max_message_size: usize,
23    pub read_timeout: Option<Duration>,
24    pub write_timeout: Option<Duration>,
25}
26
27impl Default for WebSocketConfig {
28    fn default() -> Self {
29        Self {
30            max_frame_size: 16 * 1024 * 1024,
31            max_message_size: 16 * 1024 * 1024,
32            read_timeout: None,
33            write_timeout: None,
34        }
35    }
36}