WebsockexNova.Gun.FrameHandlers.ControlFrameHandler (WebsockexNova v0.1.1)
View SourceHandler for WebSocket control frames (ping, pong, close).
Implements encoding, decoding, and validation specific to control frames.
Summary
Functions
Validates a WebSocket close code according to the protocol.
Validates that a control frame payload isn't too large.
Functions
Validates a WebSocket close code according to the protocol.
Parameters
code
- The close code to validate
Returns
:ok
- If the close code is valid{:error, reason}
- If the close code is invalid or reserved
Validates that a control frame payload isn't too large.
WebSocket protocol limits control frame payloads to 125 bytes.
Parameters
data
- The binary payload to check
Returns
:ok
- If the payload size is valid{:error, :control_frame_too_large}
- If the payload is too large