# `ExWapp.Transport.Frame`
[🔗](https://github.com/elchemista/ex_wapp/blob/v0.1.5/lib/ex_wapp/transport/frame.ex#L1)

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.

# `decode`

```elixir
@spec decode(binary()) :: {[binary()], binary()}
```

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.

# `encode`

```elixir
@spec encode(binary(), keyword()) :: binary()
```

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.

# `header`

```elixir
@spec header() :: binary()
```

Returns the static WA connection header.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
