class
Amber::WebSockets::BoundedProtocol
- Amber::WebSockets::BoundedProtocol
- HTTP::WebSocket::Protocol
- Reference
- Object
Overview
A WebSocket protocol reader that caps how many bytes one message may accumulate while its frames and fragments arrive.
Crystal's HTTP::WebSocket reads each frame in 4 KiB blocks and joins
fragments into one message. This reader counts the payload bytes of
the data message being assembled (text, binary, and continuation
frames) and, separately, of a control frame, as each block arrives.
When a count passes max_message_bytes it sends a close frame with
code 1009 (message too big) and stops reading, so an oversized message
is never assembled.