~/docs
Resonate
Resonate
1.x 1.5.0, current
Resonate
Toggle sidebar
Resonate
webpatser/resonate 1.5.0

Resonate 1.x

Configuration

Every server, application and resource-limit key in config/reverb.php with its environment variable and default.

Resonate reads the same config/reverb.php as Laravel Reverb. The file has three top-level keys: default, servers and apps.

Server

Keys under servers.reverb.

Key Environment variable Default Purpose
host REVERB_SERVER_HOST 0.0.0.0 Address the server binds to.
port REVERB_SERVER_PORT 8080 Port the server listens on.
path REVERB_SERVER_PATH empty Path prefix for all routes.
hostname REVERB_HOST none Hostname the server is accessible from.
options.tls none [] TLS context options.
max_request_size REVERB_MAX_REQUEST_SIZE 10000 Largest accepted HTTP request body.
auth_timestamp_grace REVERB_AUTH_TIMESTAMP_GRACE 600 Seconds auth_timestamp may differ from the server clock on REST API requests. 0 disables the check.
trusted_proxies REVERB_TRUSTED_PROXIES empty Comma-separated CIDR ranges or addresses of reverse proxies.
connection_limit REVERB_CONNECTION_LIMIT unlimited Total open TCP connections per node.
connection_limit_per_ip REVERB_CONNECTION_LIMIT_PER_IP unlimited Open connections per TCP peer address.
event_loop FLEDGE_EVENT_LOOP auto Event loop driver: auto, poll or select.
tcp_keepalive REVERB_TCP_KEEPALIVE false TCP keep-alive on accepted connections.
drain_timeout REVERB_DRAIN_TIMEOUT 30 Seconds the server waits for connections to close after a reload or SIGUSR2.
pulse_ingest_interval REVERB_PULSE_INGEST_INTERVAL 15 Seconds between Pulse ingests.
telescope_ingest_interval REVERB_TELESCOPE_INGEST_INTERVAL 15 Seconds between Telescope ingests.
plugins none [] Class names of server plugins.

Resource limits

Defaults are set for a shared, multi-tenant process. Set any of these to 0 to disable the check.

Key (under servers.reverb) Environment variable Default What it bounds
max_channel_name_length REVERB_MAX_CHANNEL_NAME_LENGTH 255 Length of a channel name a client may subscribe to. An over-long subscribe is rejected with pusher:subscription_error (InvalidChannelName, status 4300); the connection stays open.
validate_channel_names REVERB_VALIDATE_CHANNEL_NAMES true Restricts channel names to Pusher's charset A-Z a-z 0-9 _ - = @ , . ; (plus the #server-to-user- prefix) on subscribe, unsubscribe and the REST channel and event endpoints. A boolean, not a 0 limit. Violations get pusher code 4200 over the socket and HTTP 400 or 422 over REST.
max_subscriptions_per_connection REVERB_MAX_SUBSCRIPTIONS_PER_CONNECTION 250 Distinct channels one connection may hold. An over-cap subscribe is rejected with pusher:subscription_error (LimitReached, status 4300).
connection_limit REVERB_CONNECTION_LIMIT unlimited Total open TCP connections per node (WebSocket upgrades and HTTP API calls alike), applied before any Resonate code runs. A connection over the cap is closed without a Pusher error. Unset, null, '' and 0 all mean unlimited.
connection_limit_per_ip REVERB_CONNECTION_LIMIT_PER_IP unlimited Open connections per TCP peer address (loopback is exempt). Behind a reverse proxy every client shares the proxy's address.
max_outbound_queue_size REVERB_MAX_OUTBOUND_QUEUE_SIZE 1000 Messages that may wait on one connection. Exceeding it closes the connection with WebSocket code 1013.
scaling.max_queued_messages REVERB_SCALING_MAX_QUEUED_MESSAGES 10000 Inbound pub/sub envelopes waiting to be handled. Envelopes arriving while the queue is full are dropped and logged.

Trusted proxies

trusted_proxies lists the reverse proxies or load balancers, as CIDR ranges or bare addresses, whose X-Forwarded-For header is believed. A connection whose TCP peer is in the list is rate limited as the right-most X-Forwarded-For address that is not itself a trusted proxy. From any other peer the header is ignored. Without it, every client behind a proxy shares the proxy's message rate-limit quota. An entry that is not an IP address or CIDR range makes resonate:start refuse to boot.

REVERB_TRUSTED_PROXIES=10.0.0.0/8,fd00::/8

Outbound queues

Every connection owns an outbound queue drained by a single writer fiber. send() queues and returns, so a client that stops reading its socket suspends only its own writer instead of stalling the channel fan-out. One writer per connection keeps frames in the order they were queued.

The bound exists because unbounded buffering trades a stall for memory exhaustion. Budget for it as the bound multiplied by your average payload multiplied by the number of connections that can fall behind at once. A connection closed with 1013 reconnects and resubscribes on its own, which is standard Pusher client behaviour.

TCP keep-alive

TCP_NODELAY is always set on the listening socket, TLS included. TCP keep-alive is off by default, since the Pusher protocol already pings quiet clients (ping_interval) and prunes the ones that stop answering. Set REVERB_TCP_KEEPALIVE=true (operating system timings) or a number of idle seconds (REVERB_TCP_KEEPALIVE=60) when a NAT or firewall drops idle flows sooner. An invalid value makes resonate:start refuse to boot.

Applications

Keys under apps.apps[]. The provider is config.

Key Environment variable Default Purpose
key REVERB_APP_KEY none Application key.
secret REVERB_APP_SECRET none Signs channel auth and REST API requests. Treat it like a database password.
app_id REVERB_APP_ID none Application id.
options.host REVERB_HOST none Host used by the broadcaster.
options.port REVERB_PORT 443 Port used by the broadcaster.
options.scheme REVERB_SCHEME https Scheme used by the broadcaster.
allowed_origins none ['*'] Origins that may connect. Tighten it before production.
ping_interval REVERB_APP_PING_INTERVAL 60 Seconds between pings to quiet clients. Clients that stop answering are pruned.
activity_timeout REVERB_APP_ACTIVITY_TIMEOUT 30 The Pusher activity timeout, in seconds.
max_connections REVERB_APP_MAX_CONNECTIONS none Caps the total connections of this app. Unset by default.
max_message_size REVERB_APP_MAX_MESSAGE_SIZE 10000 Largest message in bytes, enforced per application.
accept_client_events_from REVERB_APP_ACCEPT_CLIENT_EVENTS_FROM members Which connections may send client events.
rate_limiting.enabled REVERB_APP_RATE_LIMITING_ENABLED false Message rate limiting.
rate_limiting.max_attempts REVERB_APP_RATE_LIMIT_MAX_ATTEMPTS 60 Messages allowed per window.
rate_limiting.decay_seconds REVERB_APP_RATE_LIMIT_DECAY_SECONDS 60 Window length.
rate_limiting.terminate_on_limit REVERB_APP_RATE_LIMIT_TERMINATE false Close the connection when the limit is hit.

Message size

max_message_size is enforced per application. The application is known during the handshake, so each connection's RFC 6455 parser carries its own application's limit and an oversized frame is refused on its header with close code 1009, before a payload byte is buffered. The protocol layer re-checks the assembled message and rejects it with pusher code 4019.

The server-wide limit is the smallest limit configured across your applications. It governs only an upgrade whose app key resolves to no application. Such a connection is closed with pusher code 4001.

Next steps