WebSocket frame encoding and decoding utilities.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
decode | 1 | Decode an incoming WebSocket frame from Gun or direct format. | frame: value |
pong | 1 | Create a WebSocket pong frame with optional payload. | payload: value |
ping | 0 | Create a WebSocket ping frame. | - |
binary | 1 | Encode binary data as a WebSocket frame. | data: value |
text | 1 | Encode a text message as a WebSocket frame. | message: value |
Summary
Functions
Encode binary message as WebSocket frame.
Decode incoming WebSocket frame. Handles both Gun WebSocket format {:ws, type, data} and direct frame format {:type, data}.
Create ping frame.
Create pong frame with payload.
Encode text message as WebSocket frame.
Types
@type frame() :: {frame_type(), binary()}
@type frame_type() :: :text | :binary | :ping | :pong | :close
Functions
Encode binary message as WebSocket frame.
Decode incoming WebSocket frame. Handles both Gun WebSocket format {:ws, type, data} and direct frame format {:type, data}.
@spec ping() :: frame()
Create ping frame.
Create pong frame with payload.
Encode text message as WebSocket frame.