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::{
15    WebSocket, WebSocketFrame, WebSocketFrameOpcode, WebSocketReader, WebSocketWriter,
16};
17pub use error::{WebSocketError, WebSocketResult};
18pub use message::{CloseCode, CloseFrame, Message, PreparedMessage};
19
20/// WebSocket frame/message limits and idle timeouts.
21#[derive(Debug, Clone)]
22pub struct WebSocketConfig {
23    pub max_frame_size: usize,
24    pub max_message_size: usize,
25    pub read_timeout: Option<Duration>,
26    pub write_timeout: Option<Duration>,
27}
28
29impl Default for WebSocketConfig {
30    fn default() -> Self {
31        Self {
32            max_frame_size: 16 * 1024 * 1024,
33            max_message_size: 16 * 1024 * 1024,
34            read_timeout: None,
35            write_timeout: None,
36        }
37    }
38}