Start free trial
Start free trial Log in

14-day free trial. No credit card.

Monitoring Laravel Reverb

WebSocket servers don't fit the request-response APM model, so here's what to watch for Reverb in production.

  • Guide
  • 3 min read

How do I monitor Laravel Reverb in production?

Track four signals: active WebSocket connections, broadcast throughput, memory per worker, and failed broadcasts. Reverb reports connections and messages to Laravel Pulse through its own recorders, and serves Pusher-compatible /connections and /channels endpoints. Memory growth over time is the leak signal worth watching, since Reverb workers are long-running ReactPHP processes. NightOwl records queued broadcasts as jobs on the Laravel side; it doesn't instrument the Reverb server itself.

Updated

Reverb breaks an assumption most Laravel monitoring is built on: that work happens inside a request and ends when the response is sent. A WebSocket connection can stay open for hours, a worker process can run for days, and "success" means a message reached a socket rather than that something returned a 200. None of that shows up in a request-oriented dashboard, which is why Reverb needs its own monitoring lens, and why request-based APMs only see the dispatch side, not the delivery side.

Why Reverb doesn't fit normal APM

Reverb is a long-running ReactPHP process serving WebSocket connections. It doesn't handle HTTP requests in the usual sense. APMs that record per-request telemetry see the Laravel side of broadcasting (the request that calls broadcast(), and the queued job that sends it to Reverb) but not the WebSocket-side message delivery, connections, or per-client state.

You need two layers:

  • Laravel side (dispatch): your normal APM sees the request that broadcasts and, for queued broadcasts, the job that sends the event to Reverb
  • Reverb worker side (delivery): process-level monitoring: memory, connections, throughput, errors

Reading Reverb's metrics

Reverb has no stats endpoint or Prometheus exporter. It ships two Laravel Pulse recorders instead, one for connections and one for messages:

config/pulse.php

php
'recorders' => [
    \Laravel\Reverb\Pulse\Recorders\ReverbConnections::class => [
        'sample_rate' => 1,
    ],

    \Laravel\Reverb\Pulse\Recorders\ReverbMessages::class => [
        'sample_rate' => 1,
    ],

    // ...
],

Add the <livewire:reverb.connections /> and <livewire:reverb.messages /> cards to your Pulse dashboard to chart them. For a point-in-time count you can forward to another tool, Reverb answers the Pusher-compatible HTTP API. The Pusher PHP SDK behind Laravel's reverb broadcaster signs the requests for you:

php
use Illuminate\Support\Facades\Broadcast;

$pusher = Broadcast::connection('reverb')->getPusher();

$connections = $pusher->get('/connections');  // GET /apps/{app_id}/connections
$channels = $pusher->get('/channels');        // GET /apps/{app_id}/channels

Detecting memory leaks

Reverb workers are long-lived. Leaks accumulate slowly until the process OOMs or degrades:

Supervisor config

ini
[program:reverb]
process_name=%(program_name)s
command=php /home/forge/app.com/artisan reverb:start
autostart=true
autorestart=true
user=forge
stdout_logfile=/home/forge/.forge/reverb.log
stopwaitsecs=3600
; Supervisor has no memory limit setting. Recycle the process
; with php artisan reverb:restart instead (see below).

Schedule php artisan reverb:restart (nightly, for example) as a leak safety net. Reverb closes its connections gracefully, the process exits, and Supervisor starts a fresh one. Run the same command on deploy so Reverb picks up new code.

Tracking broadcast dispatch from Laravel

A queued broadcast runs as an Illuminate\Broadcasting\BroadcastEvent job, which is why NightOwl shows it on the Jobs page (listed under your event's class name, since that's the job's display name). BroadcastEvent is a job, not an event, so Event::listen on it never fires. Hook the queue events and filter for it instead:

app/Providers/AppServiceProvider.php

php
use Illuminate\Broadcasting\BroadcastEvent;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Support\Facades\Event;

public function boot(): void
{
    Event::listen(function (JobProcessed $event) {
        if (($event->job->payload()['data']['commandName'] ?? null) !== BroadcastEvent::class) {
            return;
        }

        logger()->info('Broadcast sent to Reverb', [
            'event' => $event->job->resolveName(),
            'queue' => $event->job->getQueue(),
        ]);
    });
}

Broadcasts that implement ShouldBroadcastNow skip the queue and are sent during the request, so they don't produce a job record.

Scaling Reverb horizontally

Multiple Reverb processes coordinate via Redis pub/sub. Monitor both:

  • Redis pub/sub channel subscribers (should match Reverb process count)
  • Redis availability (Redis relays messages between Reverb servers and doesn't buffer them, so a Redis outage stops cross-server delivery)
  • Per-process connection distribution (load balancer should spread evenly)

Alerting thresholds

Signal Alert threshold
Active connections per app> 80% of the app's max_connections
Memory per process> 2x baseline, sustained 1h
Failed broadcast jobsany, investigate
Worker crashesany, investigate

See your broadcast jobs next to the rest of your app

NightOwl doesn't instrument the Reverb server, but it records each queued broadcast as a job, listed under your event's class name, with its p50, p95 and p99 duration. A broadcast that fails shows its exception, and a new exception opens an issue that can alert you.

No credit card needed.

Frequently asked questions

Anything else, write to support@usenightowl.com

What is Laravel Reverb?

Reverb is the official first-party WebSocket server for Laravel broadcasting, launched in 2024. It's a drop-in replacement for Pusher / Soketi: same protocol, Laravel-native code, runs on ReactPHP. Scales horizontally across multiple servers via Redis pub/sub.

What do I need to monitor for Laravel Reverb?

Four things: (1) active WebSocket connection count, for capacity planning; (2) message throughput (broadcasts per second), a load signal; (3) memory per Reverb process, to detect leaks early; (4) failed broadcasts, meaning queued broadcast jobs that failed to reach Reverb. Reverb reports connections and messages to Laravel Pulse through its own recorders, and answers the Pusher-compatible HTTP API for connection and channel counts.

How do I track WebSocket connections in Laravel?

Two ways. Add Reverb's Pulse recorders (ReverbConnections and ReverbMessages) to config/pulse.php and put the reverb.connections and reverb.messages cards on your Pulse dashboard to chart connections and message throughput over time. For a point-in-time count, call the Pusher-compatible endpoints Reverb serves: GET /apps/{app_id}/connections and GET /apps/{app_id}/channels (signed with your app key and secret, which the Pusher PHP SDK does for you). For presence channels, /apps/{app_id}/channels/{channel}/users lists who is connected.

How do I detect Reverb memory leaks?

Reverb workers are long-running ReactPHP processes, so leaks accumulate. Graph each process's resident memory (RSS) from the operating system over time. Stable workers hover around a baseline; leaky ones drift upward. Common leak sources: unbounded subscriber storage, event listeners not detaching, closures holding references. Supervisor has no memory limit setting, so schedule php artisan reverb:restart as a safety net: Reverb closes its connections gracefully and Supervisor starts a fresh process.

How is monitoring Reverb different from monitoring a normal Laravel app?

Two ways. First, Reverb workers don't serve HTTP requests, so request-oriented APMs don't surface their activity. You need process-level monitoring (memory, CPU, connections). Second, broadcasts don't fit the request-response model: success means the message reached the subscriber's WebSocket, not a 200 status. Failure detection requires instrumenting the broadcast side (broadcast rejection, connection drops).

Does NightOwl support Laravel Reverb?

Partially. NightOwl sees the Laravel side: queued broadcasts run as jobs, so they show up on the Jobs page under the event's class name, with duration, status and any exception. Broadcasts sent with ShouldBroadcastNow aren't recorded. Reverb's WebSocket server is a separate process and NightOwl doesn't instrument it. Use Reverb's Pulse recorders for connection and message counts.

What alerts should I set for Reverb in production?

Alert on: (1) connection count approaching capacity (the max_connections you set per app in config/reverb.php), (2) sustained memory growth over a 1-hour window, (3) failed broadcast jobs, (4) any worker crash. Pair with uptime checks against the WebSocket endpoint.

Flat pricing, whatever your traffic does

Every plan starts with a 14-day free trial. No credit card needed.

Hobby
$5 a month

One app for a side project. Issues and alerts, with a 14-day dashboard window.

Start my 14-day trial
TeamRecommended
$15 a month

Up to 3 apps and 5 people per team. Full history, the MCP server, data clearing and agent health.

Start my 14-day trial
Agency
$69 a month

Unlimited client apps and people, one overview of every app, and apps you can hand over.

Start my 14-day trial

Related guides

Related

Track your broadcast jobs on your own app

Install the agent on the Laravel side and every queued broadcast shows up on the Jobs page. No credit card needed.