Per-connection hard limits.
Every limit exists to keep a broken or hostile peer from making the
server use unbounded memory or hold a connection open forever. When a
limit is hit the connection is closed with
{:protocol_error, reason} and the listener is unaffected.
| Option | Default | What it bounds |
|---|---|---|
:max_chunk_size | 1 MiB (1_048_576) | The largest chunk size a peer may set with Set Chunk Size. |
:max_message_size | 8 MiB (8_388_608) | The largest single message (e.g. one video keyframe) a peer may declare. |
:max_chunk_streams | 16 | Distinct chunk stream IDs tracked per connection. Real encoders use fewer than 8. |
:max_buffered_bytes | 16 MiB (16_777_216) | Total bytes held in partially received messages across all chunk streams of one connection. |
:idle_timeout | 30_000 ms | Close the connection if no bytes arrive for this long after the handshake. |
:handshake_timeout | 10_000 ms | Close the connection if any single handshake step takes longer than this. |
The worst-case memory a single connection can hold in reassembly buffers
is therefore max_buffered_bytes (plus at most one chunk of unparsed
input), regardless of what the peer sends.
Summary
Functions
Builds limits from a keyword list (or returns an existing struct as is).
Types
@type t() :: %RTMP.Limits{ handshake_timeout: pos_integer(), idle_timeout: pos_integer(), max_buffered_bytes: pos_integer(), max_chunk_size: pos_integer(), max_chunk_streams: pos_integer(), max_message_size: pos_integer() }
Functions
Builds limits from a keyword list (or returns an existing struct as is).
Raises ArgumentError on unknown keys or values that aren't positive
integers — this is configuration, checked once at startup.