WebsockexNova.Gun.FrameHandlers.FrameHandler behaviour (WebsockexNova v0.1.1)
View SourceBehavior defining how to handle different types of WebSocket frames.
This behavior allows for pluggable frame handling, making it easy to extend with custom frame types or specialized processing.
Summary
Callbacks
Decodes a frame received from Gun.
Encodes a frame for sending via Gun.
Validates a frame of a specific type.
Callbacks
Decodes a frame received from Gun.
Parameters
frame
- The frame received from Gun
Returns
{:ok, decoded_frame}
- Successfully decoded frame{:error, reason}
- Error decoding the frame
Encodes a frame for sending via Gun.
Parameters
frame
- The frame to encode
Returns
The encoded frame ready for sending through Gun.
Validates a frame of a specific type.
Parameters
frame
- The frame to validate
Returns
:ok
- If the frame is valid{:error, reason}
- If the frame is invalid