WhatsApp-specific websocket frame encoding.
Frames are encoded as a WA header (sent once per connection) followed by a 24-bit big-endian payload length and the raw payload bytes.
Summary
Functions
Consumes as many frames as possible from buffer.
Wraps the given payload in a WA websocket frame.
Returns the static WA connection header.
Functions
Consumes as many frames as possible from buffer.
Returns {frames, rest} where frames is a list of payload binaries in FIFO
order and rest is the leftover buffer that did not yet form a full frame.
Wraps the given payload in a WA websocket frame.
The :include_header option ensures the header is prefixed once per
connection. Callers are expected to keep track of whether the header was
already sent for a connection and set the option accordingly.
@spec header() :: binary()
Returns the static WA connection header.