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

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

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

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Laravel Reverb in Production: Scaling WebSockets, Auth Channels, and Presence at Load        On this page       1. [  Why Reverb Changes the WebSocket Story for Laravel ](#why-reverb-changes-the-websocket-story-for-laravel)
2. [  Deployment Architecture ](#deployment-architecture)
3. [  Horizontal Scaling with Redis ](#horizontal-scaling-with-redis)
4. [  Private and Presence Channel Auth ](#private-and-presence-channel-auth)
5. [  Connection Limits and Tuning ](#connection-limits-and-tuning)
6. [  Key Takeaways ](#key-takeaways)

  ![Laravel Reverb in Production: Scaling WebSockets, Auth Channels, and Presence at Load](https://cdn.msaied.com/684/1c8fcd52449a6596e09ec043b245955f.png)

  #laravel   #websockets   #reverb   #broadcasting   #scaling  

 Laravel Reverb in Production: Scaling WebSockets, Auth Channels, and Presence at Load 
=======================================================================================

     20 Sep 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said  

       Table of contents

1. [  01   Why Reverb Changes the WebSocket Story for Laravel  ](#why-reverb-changes-the-websocket-story-for-laravel)
2. [  02   Deployment Architecture  ](#deployment-architecture)
3. [  03   Horizontal Scaling with Redis  ](#horizontal-scaling-with-redis)
4. [  04   Private and Presence Channel Auth  ](#private-and-presence-channel-auth)
5. [  05   Connection Limits and Tuning  ](#connection-limits-and-tuning)
6. [  06   Key Takeaways  ](#key-takeaways)

 Why Reverb Changes the WebSocket Story for Laravel
--------------------------------------------------

Before Reverb, running WebSockets in Laravel meant operating a separate Node.js process (Pusher-compatible servers like Soketi or Laravel Echo Server) alongside your PHP app. Reverb collapses that into a single PHP binary, shares your existing service container, and integrates natively with Laravel's broadcasting system. That simplicity is real — but production deployments surface a set of concerns that the getting-started docs gloss over.

---

Deployment Architecture
-----------------------

Reverb runs as a long-lived Ratchet/ReactPHP process. It is **not** a traditional PHP-FPM request; it is a persistent server. That changes how you deploy it.

```bash
# Start Reverb (production)
php artisan reverb:start --host=0.0.0.0 --port=8080 --env=production

```

Manage it with Supervisor so it restarts on failure:

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

```

Nginx proxies WebSocket upgrades to Reverb while your normal FPM traffic continues on port 80/443:

```nginx
location /app {
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_read_timeout 3600;
}

```

---

Horizontal Scaling with Redis
-----------------------------

A single Reverb process is bound to one machine. When you scale to multiple app servers, a client connected to server A won't receive events broadcast from server B. The fix is the Redis scaling driver, which uses Pub/Sub to fan out events across all Reverb nodes.

```php
// config/reverb.php
'scaling' => [
    'driver' => 'redis',
    'connection' => 'default', // your Redis connection from database.php
],

```

Each Reverb node subscribes to the same Redis channel. When your application fires a broadcast event, any node can pick it up and push it to the connected clients it owns. This requires **sticky sessions** at your load balancer (or a session-affinity cookie) so that the WebSocket handshake and subsequent frames always hit the same node.

> **Gotcha:** If you skip sticky sessions, the HTTP-based channel auth endpoint (`/broadcasting/auth`) may be handled by a different server than the one holding the WebSocket connection. The auth will succeed, but Reverb on the other node won't have the subscription registered. Always pair Redis scaling with L4/L7 sticky routing.

---

Private and Presence Channel Auth
---------------------------------

Reverb reuses Laravel's existing `BroadcastServiceProvider` and channel definitions:

```php
// routes/channels.php
Broadcast::channel('orders.{orderId}', function (User $user, int $orderId) {
    return $user->can('view', Order::findOrFail($orderId));
});

Broadcast::channel('presence.team.{teamId}', function (User $user, int $teamId) {
    if ($user->belongsToTeam($teamId)) {
        return ['id' => $user->id, 'name' => $user->name];
    }
});

```

Presence channels return an array on success; that payload becomes the member data visible to all subscribers. Returning `false` or `null` denies access.

On the frontend with Echo:

```javascript
window.Echo.join(`presence.team.${teamId}`)
    .here(members => console.log('Online:', members))
    .joining(member => console.log('Joined:', member.name))
    .leaving(member => console.log('Left:', member.name));

```

---

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

Reverb exposes connection limits per application in `config/reverb.php`. Under load, the bottleneck is usually open file descriptors, not CPU. Raise the OS limit:

```bash
# /etc/security/limits.conf
www-data soft nofile 65535
www-data hard nofile 65535

```

Also tune the `max_connections` and `max_request_size` settings:

```php
'apps' => [[
    'id' => env('REVERB_APP_ID'),
    'key' => env('REVERB_APP_KEY'),
    'secret' => env('REVERB_APP_SECRET'),
    'options' => [
        'host' => env('REVERB_HOST', '0.0.0.0'),
        'port' => env('REVERB_PORT', 8080),
        'max_message_size' => 10_000, // bytes
    ],
]],

```

---

Key Takeaways
-------------

- Reverb is a persistent PHP process — manage it with Supervisor, not FPM.
- Use the Redis scaling driver for multi-node deployments; pair it with sticky sessions at the load balancer.
- Channel auth runs through your normal Laravel HTTP stack — policies and gates work as expected.
- Presence channel member data is the array returned from the channel callback, not a separate API call.
- Raise OS file descriptor limits before you hit connection ceilings in production.
- `max_message_size` is your first line of defense against oversized payloads crashing the event loop.

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-reverb-in-production-scaling-websockets-auth-channels-and-presence-at-load&text=Laravel+Reverb+in+Production%3A+Scaling+WebSockets%2C+Auth+Channels%2C+and+Presence+at+Load) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-reverb-in-production-scaling-websockets-auth-channels-and-presence-at-load) 

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

  3 questions  

     Q01  Can Reverb replace Pusher entirely, including the client-side SDK?        Yes. Reverb implements the Pusher protocol, so Laravel Echo works unchanged. You only update the broadcaster config to point at your Reverb host instead of Pusher's servers. No client-side code changes are required. 

      Q02  Does Reverb support SSL termination directly?        The recommended approach is to terminate TLS at Nginx or a load balancer and proxy plain WebSocket traffic to Reverb on a local port. Reverb can handle TLS natively via its `tls` options, but offloading to a reverse proxy is simpler to certificate-manage in production. 

      Q03  What happens to connected clients during a Reverb restart or deployment?        Existing WebSocket connections are dropped when the process restarts. Echo's reconnection logic will re-establish them automatically within a few seconds. For zero-downtime deployments, run two Reverb processes behind the load balancer and drain one before restarting it. 

  Continue reading

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

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

 [ ![Filament v4 Render Hooks: Injecting UI Into Any Panel Layer Without Hacks](https://cdn.msaied.com/683/e6350724743c14481d11da6bd38e44e2.png) filament laravel filament-v4 

### Filament v4 Render Hooks: Injecting UI Into Any Panel Layer Without Hacks

Render hooks let you inject Blade or Livewire content into specific Filament panel slots without overriding co...

  ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said 

 20 Sep 2026     3 min read  

  Read    

 ](https://msaied.com/articles/filament-v4-render-hooks-injecting-ui-into-any-panel-layer-without-hacks) [ ![MySQL EXPLAIN and Index Tuning for Laravel: Reading Query Plans in Production](https://cdn.msaied.com/682/ce36e9a53f64f4683147fdbc73e72caa.png) laravel mysql performance 

### MySQL EXPLAIN and Index Tuning for Laravel: Reading Query Plans in Production

Stop guessing why your Laravel queries are slow. Learn to read MySQL EXPLAIN output, spot full-table scans, an...

  ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said 

 20 Sep 2026     4 min read  

  Read    

 ](https://msaied.com/articles/mysql-explain-and-index-tuning-for-laravel-reading-query-plans-in-production) [ ![Practical RAG in Laravel: pgvector, Embeddings, and Retrieval-Augmented Generation](https://cdn.msaied.com/681/08058424f0e8433b83d9008c6b701cd8.png) laravel ai pgvector 

### Practical RAG in Laravel: pgvector, Embeddings, and Retrieval-Augmented Generation

Build a production-ready RAG pipeline in Laravel using pgvector, OpenAI embeddings, and a clean retrieval laye...

  ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said 

 19 Sep 2026     4 min read  

  Read    

 ](https://msaied.com/articles/practical-rag-in-laravel-pgvector-embeddings-and-retrieval-augmented-generation) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://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://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://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)
