Scaling Laravel Reverb WebSockets in Production | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com) [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles  ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

  [ home ](https://www.msaied.com)    [ articles ](https://www.msaied.com/articles)    Laravel WebSocket Broadcasting with Reverb: Scaling Beyond a Single Worker        On this page       1. [  The Single-Worker Problem ](#the-single-worker-problem)
2. [  Enabling Redis Pub/Sub in Reverb ](#enabling-redis-pubsub-in-reverb)
3. [  Running Multiple Reverb Workers ](#running-multiple-reverb-workers)
4. [  Nginx WebSocket Proxy ](#nginx-websocket-proxy)
5. [  Tuning Connection Limits ](#tuning-connection-limits)
6. [  Keeping Broadcasts Reliable ](#keeping-broadcasts-reliable)
7. [  Health Checks ](#health-checks)
8. [  Takeaways ](#takeaways)

  ![Laravel WebSocket Broadcasting with Reverb: Scaling Beyond a Single Worker](https://cdn.msaied.com/335/b2461babce9e90ae5fe8dc789cd7046c.png)

  #laravel   #reverb   #websockets   #broadcasting   #redis  

 Laravel WebSocket Broadcasting with Reverb: Scaling Beyond a Single Worker 
============================================================================

     1 Jul 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   The Single-Worker Problem  ](#the-single-worker-problem)
2. [  02   Enabling Redis Pub/Sub in Reverb  ](#enabling-redis-pubsub-in-reverb)
3. [  03   Running Multiple Reverb Workers  ](#running-multiple-reverb-workers)
4. [  04   Nginx WebSocket Proxy  ](#nginx-websocket-proxy)
5. [  05   Tuning Connection Limits  ](#tuning-connection-limits)
6. [  06   Keeping Broadcasts Reliable  ](#keeping-broadcasts-reliable)
7. [  07   Health Checks  ](#health-checks)
8. [  08   Takeaways  ](#takeaways)

 The Single-Worker Problem
-------------------------

Laravel Reverb is a first-party WebSocket server written in PHP using ReactPHP. Out of the box it runs as a single process, which is fine for development and low-traffic apps. The moment you deploy multiple application servers — or your connection count climbs past a few thousand — you hit a wall: clients connected to server A never receive events published from server B.

The fix is a shared pub/sub backend. Reverb supports Redis as a message bus so every worker node subscribes to the same channel stream.

Enabling Redis Pub/Sub in Reverb
--------------------------------

In `config/reverb.php`, switch the `scaling` driver:

```php
'servers' => [
    'reverb' => [
        // ...
        'scaling' => [
            'enabled' => true,
            'driver'  => 'redis',
            'connection' => 'default', // your redis connection name
        ],
    ],
],

```

Reverb uses a dedicated Redis Pub/Sub connection (not the cache or queue connection) so it never blocks your job workers. Make sure the `redis` extension or `predis/predis` is available and that your Redis instance allows enough concurrent clients.

Running Multiple Reverb Workers
-------------------------------

Each node starts its own Reverb process. Supervisor is the standard approach:

```ini
[program:reverb-worker]
command=php /var/www/artisan reverb:start --host=0.0.0.0 --port=8080
autostart=true
autorestart=true
stopwaitsecs=10
numprocs=1
stdout_logfile=/var/log/reverb.log

```

Behind a load balancer, every node listens on the same port. The load balancer must support **sticky sessions** (IP hash or cookie-based) for the WebSocket upgrade handshake, but once the connection is established the Redis layer handles cross-node delivery transparently.

### Nginx WebSocket Proxy

```nginx
upstream reverb {
    ip_hash; # sticky sessions for WS upgrade
    server 10.0.0.1:8080;
    server 10.0.0.2:8080;
}

server {
    listen 443 ssl;
    server_name ws.example.com;

    location / {
        proxy_pass http://reverb;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 3600s;
    }
}

```

Tuning Connection Limits
------------------------

ReactPHP uses a non-blocking event loop, so a single Reverb process can hold thousands of open file descriptors. The OS default `ulimit -n` is often 1024 — far too low.

Set it in Supervisor:

```ini
[program:reverb-worker]
; ...
minfds=65536

```

Or in your systemd unit:

```ini
[Service]
LimitNOFILE=65536

```

Also raise `max_connections` in `config/reverb.php`:

```php
'options' => [
    'tls' => [],
    'max_request_size' => 10_000,
],

```

Reverb itself does not hard-cap connections by default, but you can add application-level guards via the `Reverb\Contracts\ServerFactory` if you need per-channel or per-app limits.

Keeping Broadcasts Reliable
---------------------------

Broadcasting from a queued job is the safest pattern. Never broadcast synchronously inside a request when you expect high throughput:

```php
broadcast(new OrderShipped($order))->via('reverb');
// or inside a queued job:
public function handle(): void
{
    broadcast(new OrderShipped($this->order));
}

```

If the Reverb server is temporarily unreachable, the queued job will retry according to your queue configuration rather than silently dropping the event.

### Health Checks

Reverb exposes a simple HTTP health endpoint when started with `--debug` or via a custom route. Wire it into your load balancer's health check so unhealthy nodes are removed automatically:

```bash
curl -f http://10.0.0.1:8080/apps/{app_id}/health

```

Takeaways
---------

- Enable the `redis` scaling driver in `config/reverb.php` to share state across nodes.
- Use IP-hash sticky sessions at the load balancer only for the WebSocket upgrade; post-handshake routing is handled by Redis.
- Raise `ulimit -n` (via Supervisor `minfds` or systemd `LimitNOFILE`) to at least 65 536 per node.
- Always broadcast from queued jobs so delivery survives transient Reverb restarts.
- Monitor the Redis pub/sub channel count alongside your application metrics — runaway subscriptions are a common memory leak vector.

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Flaravel-websocket-broadcasting-with-reverb-scaling-beyond-a-single-worker&text=Laravel+WebSocket+Broadcasting+with+Reverb%3A+Scaling+Beyond+a+Single+Worker) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Flaravel-websocket-broadcasting-with-reverb-scaling-beyond-a-single-worker) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Do I need sticky sessions on my load balancer when running multiple Reverb nodes?        Yes, but only for the initial WebSocket upgrade handshake. Once the connection is established, the Redis pub/sub layer ensures events published on any node are delivered to all connected clients regardless of which node they are on. 

      Q02  Can Reverb replace Pusher entirely in a high-traffic production app?        Yes. With Redis scaling enabled, proper ulimit tuning, and broadcasts dispatched through queued jobs, Reverb handles the same workload as a managed Pusher cluster while keeping all traffic within your own infrastructure. 

      Q03  What happens to in-flight WebSocket connections when I restart a Reverb worker?        Clients are disconnected and must reconnect. Laravel Echo retries automatically with exponential back-off. Use Supervisor's stopwaitsecs to allow the process to drain gracefully, and deploy rolling restarts across nodes to minimise the visible impact. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://www.msaied.com/articles) 

 [ ![Filament v5 Preview: Schema Unification, Performance Shifts, and How to Prepare](https://cdn.msaied.com/340/1a05ca68637b898b676efb66f22e627f.png) filament laravel php 

### Filament v5 Preview: Schema Unification, Performance Shifts, and How to Prepare

Filament v5 is reshaping how panels, forms, and tables are composed. This deep-dive covers the confirmed archi...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     4 min read  

  Read    

 ](https://www.msaied.com/articles/filament-v5-preview-schema-unification-performance-shifts-and-how-to-prepare) [ ![Laravel 13: New Features, Helpers, and Practical Upgrade Notes](https://cdn.msaied.com/339/58c4fa6fe9b6d25a2dac17c621b6f4c6.png) laravel laravel-13 upgrade 

### Laravel 13: New Features, Helpers, and Practical Upgrade Notes

Laravel 13 ships with async-first defaults, a leaner bootstrapping layer, and several quality-of-life helpers....

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/laravel-13-new-features-helpers-and-practical-upgrade-notes) [ ![Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping](https://cdn.msaied.com/337/05b39d16d0f88a5fb94d0cf74049b88b.png) laravel laravel-12 upgrade 

### Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping

Laravel 12 ships with a leaner skeleton, first-class route file organisation, and a revised application bootst...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/laravel-12-structured-route-files-slim-skeletons-and-the-new-application-bootstrapping) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://www.msaied.com)
- [Projects](https://www.msaied.com/projects)
- [Articles](https://www.msaied.com/articles)
- [Certificates](https://www.msaied.com/certificates)
- [Contact](https://www.msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
