Restart and reload
resonate:restart is the hard restart. It sets the laravel:reverb:restart cache key, the running server picks it up within 5 seconds, calls stop(), and your supervisor respawns it. WebSocket connections drop, and the listener is gone for the 0 to 5 second window between exit and respawn. Fine for development, rough for production deploys.
resonate:reload is the production path. The listener is bound with SO_REUSEPORT, so the new process can hold the port while the old one drains.
# Default: spawn a replacement, wait for /up, then drain the old PID.php artisan resonate:reload # Drain only (for systemd ExecReload=, Kubernetes preStop, Supervisor).php artisan resonate:reload --drain
| Option | Default | Purpose |
|---|---|---|
--drain |
off | Only signal the running server to drain; do not spawn a replacement. |
--timeout= |
30 |
Seconds to wait for the old server to exit after drain. |
--term-timeout= |
5 |
Seconds to wait for the old server to exit after SIGTERM. The reload fails rather than reporting success if the old process is still alive. |
--health-timeout= |
10 |
Seconds to wait for the new server to answer /up. |
Tune the drain window with REVERB_DRAIN_TIMEOUT (default 30 seconds). Existing WebSocket clients stay connected to the old process until they disconnect naturally or the timeout fires. SIGUSR2 drains as well.
Note: On Linux, connections still waiting in the old listener's accept backlog when it closes are reset unless
net.ipv4.tcp_migrate_req=1is set, which hands them to the new listener.
GET /up returns the PID of the process that answered alongside health, so a probe can tell the replacement apart from the outgoing server while both hold the port.
Under Supervisor
The server records at start whether it runs under Supervisor. resonate:reload then becomes drain-only: there is no overlap, so the port is briefly unserved. The Supervisor program needs autorestart=true. With the default autorestart=unexpected, a clean exit 0 after the drain is not restarted and the server stays down.
Runtime files
resonate:reload reads storage/resonate.json so a replacement inherits the CLI overrides the running server was started with, rather than falling back to config. Metadata belonging to another PID is ignored.
Event loop
resonate:start runs as one long-lived process. Before it builds the server it installs the event loop driver named by servers.reverb.event_loop, which reads FLEDGE_EVENT_LOOP.
FLEDGE_EVENT_LOOP |
Driver |
|---|---|
auto (default, also when unset) |
kqueue (macOS, BSD) or epoll (Linux) through PHP's Io\Poll; stream_select where neither exists |
poll |
kqueue or epoll; the server refuses to start when neither is available |
select |
stream_select, the rollback |
Any other value makes resonate:start refuse to boot. FLEDGE_EVENT_LOOP in the process environment wins over the setting, so FLEDGE_EVENT_LOOP=select rolls back even with a cached config (config:cache). The command logs one line when the two differ.
Connection count and file limits
With the poll driver a node is no longer capped at about a thousand connections. stream_select cannot watch a descriptor above FD_SETSIZE (usually 1024); kqueue and epoll have no such ceiling. Every connection costs one descriptor, so the limit becomes the process's open file limit. Raise it for the server process, for example LimitNOFILE=65536 in a systemd unit or ulimit -n 65536 in the script that starts it.
At startup resonate:start checks the soft open file limit against what it needs: the connection_limit setting, or 4096 connections when it is unlimited, plus 256 descriptors for the listener, Redis, the database and logs. A lower soft limit is raised as far as the hard limit allows (up to 65536) and the command says so. When the hard limit is too low it prints a warning with the numbers. Raise the hard limit for large nodes.
Behind a reverse proxy
- Set
REVERB_SERVER_HOST=127.0.0.1so only the proxy reaches the server. - List the proxy in
REVERB_TRUSTED_PROXIESso rate limiting keys on the real client address. See Configuration. - A per-IP
connection_limit_per_ipbehind a proxy limits the proxy, not the client. - Set
REVERB_TCP_KEEPALIVEwhen the proxy or a firewall drops idle flows sooner than the Pusher ping.