Skip to main content

o_sfu_rfc/
websocket.rs

1//! WebSocket limits from RFC 6455:
2//! - [Control frames, section 5.5](https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5)
3//! - [Close payload, section 5.5.1](https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.1)
4
5/// Maximum payload of a WebSocket control frame, in bytes.
6const MAX_CONTROL_PAYLOAD_BYTES: usize = 125;
7
8/// Status-code prefix of a nonempty Close frame, in bytes.
9const CLOSE_STATUS_CODE_BYTES: usize = 2;
10
11/// Maximum UTF-8 reason length after the Close frame's status code.
12pub const MAX_CLOSE_REASON_BYTES: usize = MAX_CONTROL_PAYLOAD_BYTES - CLOSE_STATUS_CODE_BYTES;