pub struct FrameConfig {
pub data_frame_payload_size: Option<usize>,
pub control_write_timeout: Duration,
pub data_frame_write_timeout: Duration,
pub read_buffer_size: usize,
pub write_buffer_size: usize,
pub max_write_buffer_size: usize,
pub max_message_size: Option<usize>,
pub max_frame_size: Option<usize>,
}Expand description
WebSocket data frame fragmentation, read and write buffers, and receive size limits.
Fields§
§data_frame_payload_size: Option<usize>Payload size, in bytes, for outgoing data-frame fragments; the default is
32 KiB and None disables active fragmentation.
Set to at least 1024 bytes, and the write buffer limit must also accommodate the payload and frame header.
Control frames can be scheduled between fragments, but cannot pre-empt an
in-progress frame or overtake bytes already buffered by the transport.
This setting does not split one logical message into multiple messages,
and does not control the peer’s outgoing frame sizes.
control_write_timeout: DurationMaximum time for a single Ping, Pong, or Close write and for closing the underlying sender; the default is 1,500 milliseconds. This bounds the local write operation, including any preceding buffered data it must drain; it is not an end-to-end peer response deadline.
data_frame_write_timeout: DurationThe time limit for writing a single data frame, the default is 1500 milliseconds; it is still subject to the overall message writing deadline. Deferred data batches retain the earliest pending frame’s deadline. Expiry after a write has started retires the connection because delivery may be partial; it does not imply a missing heartbeat Pong.
read_buffer_size: usizeThe underlying WebSocket read buffer size in bytes, default 128 KiB.
write_buffer_size: usizeTarget size of the underlying WebSocket write buffer, in bytes, defaults to 128 KiB; zero is allowed.
max_write_buffer_size: usizeMaximum number of bytes for the underlying WebSocket write buffer, defaults to 4 MiB; must be larger than the target write buffer size.
max_message_size: Option<usize>The maximum number of bytes to receive a complete message, default 64 MiB; None means not to set this size limit.
max_frame_size: Option<usize>Maximum bytes in one received frame; the default is 16 MiB and None
disables this limit.
Implementations§
Source§impl FrameConfig
impl FrameConfig
Sourcepub const MIN_DATA_FRAME_PAYLOAD_SIZE: usize = 1024
pub const MIN_DATA_FRAME_PAYLOAD_SIZE: usize = 1024
Smallest supported outgoing data-frame payload fragment.
Sourcepub const DEFAULT_DATA_FRAME_PAYLOAD_SIZE: usize
pub const DEFAULT_DATA_FRAME_PAYLOAD_SIZE: usize
Default outgoing data-frame payload fragment size.