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

Resonate 1.x

Scaling

Run several Resonate nodes that coordinate through Redis pub/sub, and what differs from Laravel Reverb under scaling.

Set REVERB_SCALING_ENABLED=true along with your REDIS_* variables. Multiple Resonate instances coordinate through Redis pub/sub on fledge-fiber's async Redis client. message, terminate and metrics events propagate across nodes.

Configuration

Keys under servers.reverb.scaling.

Key Environment variable Default Purpose
enabled REVERB_SCALING_ENABLED false Turns scaling on.
channel REVERB_SCALING_CHANNEL reverb The Redis pub/sub channel.
max_queued_messages REVERB_SCALING_MAX_QUEUED_MESSAGES 10000 Inbound envelopes waiting to be handled. Incoming pub/sub envelopes are queued and handled by a single fiber, so a slow envelope cannot stall the subscriber pump. Envelopes arriving while the queue is full are dropped and logged. 0 disables the bound.
server.url REDIS_URL none Redis URL.
server.host REDIS_HOST 127.0.0.1 Redis host.
server.port REDIS_PORT 6379 Redis port.
server.username REDIS_USERNAME none Redis username.
server.password REDIS_PASSWORD none Redis password.
server.database REDIS_DB 0 Redis database.
server.timeout REDIS_TIMEOUT 60 Redis timeout.
REVERB_SCALING_ENABLED=true
REDIS_HOST=127.0.0.1
REDIS_PORT=6379

JSON envelope

Resonate uses a pure JSON envelope for cross-node messages, with no serialize() on the wire. A cluster therefore cannot run mixed Resonate and laravel/reverb nodes. The migration is all at once.

Differences from Reverb under scaling

  • A presence channel's user_count counts distinct users across nodes. Reverb sums each node's count. During a rolling deploy from an older release, nodes on the old build still add up counts.
  • GET /apps/{app}/channels/{channel}/users returns 400 for a non-presence name where Reverb returns 404. The answer waits for the other nodes for up to the collection window, and a node that does not answer in time is left out.
  • The HTTP API signature check strips the --path prefix, whether it comes from --path or from config.

Plugins and scaling

PluginContext::broadcast() is scaling-aware: it is routed through the event dispatcher and reaches every node. PluginContext::terminate() only ends connections on the node that runs it. See Server plugins.