Why your app needs WebSockets (and why polling is a tax)
Every time a user refreshes a page to see whether an order shipped, a comment arrived, or a dashboard number moved, your app pays a tax: a full HTTP request, a full response, and a user who still might be looking at stale data. Polling every few seconds multiplies that tax across every open tab. Laravel Reverb removes it. It is Laravel’s first-party WebSocket server, built to plug straight into the framework’s event broadcasting system, so a server-side event becomes a browser update in milliseconds — no page refresh, no polling loop, no third-party service in the middle.
In this guide you will install Laravel Reverb, broadcast your first real event, listen for it with Laravel Echo, lock it down with private channels, and run it in production with Supervisor and Nginx. Everything here was verified against Laravel’s official documentation on 28 October 2026.
What Laravel Reverb actually is
Reverb is a PHP WebSocket server that runs as a long-lived Artisan process alongside your Laravel app. Your application does not talk to browsers directly; instead, it hands events to Reverb, and Reverb pushes them to every subscribed browser over a persistent connection. Because Reverb speaks the Pusher protocol, the client-side code is the same code you would write for Pusher — which means you can switch drivers later by changing one environment variable, not by rewriting your frontend.
Reverb fits anywhere a user should see a change the moment it happens: order status updates, live notifications, support chat, collaborative boards, admin dashboards, and “someone is typing” indicators. It is a poor fit for data that changes rarely (a daily report does not need a socket), and for teams that do not want to run one more long-lived process — in that case a managed service is the honest answer, and we cover that at the end.
One thing to get straight before you start: Reverb is not a queue, a cache, or a replacement for your database. It is the last mile. Your app still decides what happened; Reverb only delivers the news fast.
Install Laravel Reverb in five minutes
Reverb requires PHP 8.2 or newer and a Laravel application with broadcasting enabled. The fastest path is the installer command, which asks whether you want Reverb and then does the wiring for you:
php artisan install:broadcasting
Answer yes when it offers Reverb. Behind the scenes it installs the laravel/reverb package, publishes config/reverb.php, creates routes/channels.php for channel authorisation, writes your app credentials into .env, and creates resources/js/echo.js for the frontend. If you prefer to skip the prompt, pass the --reverb flag. You can also install it manually with composer require laravel/reverb followed by php artisan reverb:install.
Your .env will now carry the credentials the client and server exchange to verify each other:
BROADCAST_CONNECTION=reverb
REVERB_APP_ID=my-app-id
REVERB_APP_KEY=my-app-key
REVERB_APP_SECRET=my-app-secret
REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=http
Two pairs of variables are easy to confuse, so note the split: REVERB_SERVER_HOST and REVERB_SERVER_PORT control where the server listens, while REVERB_HOST and REVERB_PORT tell your app and your browsers where to reach it. In local development both point at the same place, which is why the defaults just work.
Start the server:
php artisan reverb:start
By default it binds to 0.0.0.0:8080, reachable from all network interfaces. Pass --host and --port to change that, and add --debug when you want to watch connections, messages, and broadcasts stream through your terminal — invaluable the first time you wire something up.
One prerequisite people forget: broadcast events are dispatched through queued jobs, so your queue worker must be running or nothing arrives. Start one alongside Reverb in development:
php artisan queue:work
If you are setting up queue workers for the first time, our guide to running Laravel queue workers in production with Supervisor covers the same process-management pattern you will reuse for Reverb below.
Your first broadcast event
Broadcasting in Laravel starts with an ordinary event class that implements ShouldBroadcast. Say you want customers to see an order status change without refreshing. Generate the event:
php artisan make:event OrderStatusUpdated
Then shape it so only the data the browser needs leaves the server:
<?php
namespace App\Events;
use App\Models\Order;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class OrderStatusUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(public Order $order) {}
public function broadcastOn(): array
{
return [new PrivateChannel('orders.' . $this->order->id)];
}
public function broadcastWith(): array
{
return [
'status' => $this->order->status,
'updated_at' => $this->order->updated_at->toIso8601String(),
];
}
}
Three details matter here. First, broadcastOn() decides who can receive the event — a private channel named per order, so one customer never sees another’s updates. Second, broadcastWith() limits the payload to exactly two fields; without it, the whole serialised model goes over the wire, including anything you would rather not expose. Third, the event is queued by default, which keeps your HTTP response fast. Fire it from a controller the way you would fire any event:
event(new OrderStatusUpdated($order));
Two variations are worth knowing now rather than discovering later. If an event must go out immediately — a “your export is ready” notice at the end of a long job, say — implement ShouldBroadcastNow instead of ShouldBroadcast and it uses the sync queue. And if the user who triggered the change does not need to hear about it (their UI already updated optimistically), call broadcast(new OrderStatusUpdated($order))->toOthers() to exclude the sender.
Listen on the frontend with Laravel Echo
Laravel Echo is the JavaScript library that subscribes to channels and receives your broadcasts. The installer already added it: laravel-echo and pusher-js are in your package.json, and resources/js/echo.js holds a ready-made configuration. Yes, you still need pusher-js — Reverb implements the Pusher protocol, so Echo uses it under the hood. The Echo reverb broadcaster requires laravel-echo v1.16.0 or newer.
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;
window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT,
wssPort: import.meta.env.VITE_REVERB_PORT,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
});
The VITE_ variables mirror the server-side ones and are written to your .env by the installer. Build your assets with npm run build, then subscribe. Note the event name: Echo listens for the event’s class basename by default, so OrderStatusUpdated arrives as OrderStatusUpdated — if you add a broadcastAs() method to rename it, listen for that name instead.
window.Echo.private(`orders.${orderId}`)
.listen('OrderStatusUpdated', (e) => {
document.querySelector('#order-status').textContent = e.status;
});
That is the whole loop: controller fires the event, the queue worker hands it to Reverb, Reverb pushes it to every subscribed browser, and Echo updates the page. Run php artisan reverb:start --debug in one terminal and watch the connection, subscription, and broadcast lines appear as you test — if a line is missing, you know exactly which half of the loop to debug.
Private and presence channels, done properly
Public channels need no authorisation and suit anything anyone may see, like a site-wide announcement feed. Private channels are where real apps live, and they need an authorisation callback in routes/channels.php. Laravel registers the /broadcasting/auth endpoint for you automatically; your job is only the callback:
use App\Models\Order;
use App\Models\User;
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('orders.{order}', function (User $user, Order $order) {
return $user->id === $order->user_id;
});
Channel callbacks support route model binding, so you receive a real Order model instead of a raw id — and the callback’s job is a single boolean: may this user listen or not. Return anything else and you have a bug. You can list every registered channel callback with php artisan channel:list, which is a fast way to audit what you have exposed.
Presence channels go one step further: they tell you who is subscribed. The callback returns user info instead of a boolean, and the frontend gets here(), joining(), and leaving() hooks — the building blocks of “3 people are viewing this” and typing indicators:
Broadcast::channel('chat.{roomId}', function (User $user, int $roomId) {
return ['id' => $user->id, 'name' => $user->name];
});
window.Echo.join(`chat.${roomId}`)
.here((users) => { /* render the member list */ })
.joining((user) => { /* "Ada joined" */ })
.leaving((user) => { /* "Ada left" */ });
If your frontend talks to Laravel through API tokens rather than web sessions, the authorisation route needs to move: register broadcasting routes with the api prefix and auth:sanctum middleware, and send the token with the auth request. Our Laravel Sanctum setup guide covers the token side of that arrangement.
Run Laravel Reverb in production
Reverb is a long-running process, so production means three things: keep it alive, give it enough file handles, and put it behind your web server’s TLS. Start with Supervisor, the same tool you use for queue workers. A minimal program block:
[program:reverb]
command=php /var/www/my-app/artisan reverb:start
autostart=true
autorestart=true
user=forge
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/my-app/storage/logs/reverb.log
Because Supervisor itself must be able to open the files Reverb’s connections require, raise its file limit in supervisor.conf:
[supervisord]
minfds=10000
Each WebSocket connection is held in memory and counts as an open file on Unix, so the operating system’s own limit matters too — check yours with ulimit -n and raise it in /etc/security/limits.conf if you expect real traffic. There is a second, sneakier ceiling: Reverb’s ReactPHP event loop defaults to stream_select, which tops out around 1,024 open files. Past roughly 1,000 concurrent connections you need a different loop, and Reverb switches automatically to ext-event, ext-ev, or ext-uv when one is installed via PECL:
pecl install uv
Next, TLS. In production you almost never expose Reverb’s port directly; your web server terminates TLS and reverse-proxies to it. With Nginx, the official configuration proxies to Reverb on port 8080 and forwards the upgrade headers that turn an HTTP request into a WebSocket:
server {
location / {
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://0.0.0.0:8080;
}
}
The two headers that break most first deployments are Upgrade and Connection — omit them and Nginx proxies plain HTTP, the handshake fails, and Echo reconnects forever. If you use a different web server, our Caddy reverse proxy guide shows the same pattern with automatic HTTPS. Finally, because Reverb is long-running, code changes do not reach it until you restart: run php artisan reverb:restart as part of every deploy, which gracefully terminates connections first and lets Supervisor bring the server back up. If you host on Laravel Forge, its Reverb integration applies the open-file and extension optimisations for you.
Scale past one server
One Reverb server handles a lot, but a single box has a ceiling. Scaling horizontally is one environment variable plus a shared Redis server:
REVERB_SCALING_ENABLED=true
With scaling enabled, every Reverb server publishes incoming messages over Redis to all the others, using your application’s default Redis connection, so a browser connected to server A still receives events broadcast through server B. Put the servers behind a load balancer that spreads connections evenly, and give them one dedicated central Redis instance to talk through. That is the whole architecture — no extra message broker to learn, just Redis doing what Redis already does for your queues and cache.
Laravel Reverb vs Pusher: the cost math
Reverb is open source under the MIT licence: the software costs nothing, and you pay only for the server it runs on — which, for most side projects, is a VPS you already rent. Pusher charges per connection and per message. Prices checked 28 October 2026:
| Option | Free tier | Entry paid plan |
|---|---|---|
| Laravel Reverb (self-hosted) | Unlimited — MIT licence | Your server’s cost |
| Pusher Channels Sandbox | 200,000 messages/day, 100 concurrent connections | — |
| Pusher Channels Startup | — | $49/month: 1M messages/day, 500 connections |
The honest trade is not price versus price. Pusher buys you zero operations: no Supervisor config, no file limits, no 3 a.m. process restarts. Reverb buys you no per-message bill and no connection cap imposed by someone else’s pricing page. For a side project or a SaaS under a few thousand concurrent users, Reverb on a small VPS wins on cost by a wide margin. For a team that would rather pay than operate infrastructure, Pusher — or Laravel Cloud’s managed Reverb offering, which removes the ops work while keeping the same protocol — is the better buy.
Troubleshooting: when nothing arrives
Work through this list in order before you start changing code. Most Reverb problems are configuration, not bugs.
- No queue worker running. Broadcasts are queued jobs. If
php artisan queue:workis not running, events pile up silently and nothing reaches Reverb. - Wrong event name on the frontend. Echo listens for the class basename (
OrderStatusUpdated) unless you definedbroadcastAs(). A mismatch here fails silently — the subscription works, the listener never fires. - Private channel returning 403. Check
routes/channels.phpfirst, then whether the user is actually authenticated on the/broadcasting/authrequest. API clients need the Sanctum arrangement described above. - Echo connects but never receives. Confirm Reverb is running (
reverb:start --debugshows the subscription) and thatBROADCAST_CONNECTION=reverbis set — with the wrong driver, events go to the log driver or nowhere. - Mixed content errors in the browser. An
httpspage cannot open aws://socket. SetVITE_REVERB_SCHEME=httpsand serve Reverb behind a TLS-terminating proxy. - Connections die around 1,000 users. That is the
stream_selectceiling. Installext-uv(orext-event/ext-ev) and raise your file limits. - Old code still running after a deploy. Reverb is long-running. Add
php artisan reverb:restartto your deploy script. - Requests rejected from your domain. Check
allowed_originsinconfig/reverb.php— any origin not listed is refused, which is a feature until it blocks your own frontend.
The honest verdict
Laravel Reverb is the first real-time option most Laravel developers should reach for in 2026: it is first-party, it speaks the same protocol as the service it replaces, and the whole setup — install, event, Echo listener, production process — fits in an afternoon. Its cost is operational, not financial: one more long-running process to supervise, one more set of file limits to raise, one more restart in your deploy script. If that trade sounds fine, install it, broadcast one event, and watch it land in the browser without a refresh. That moment is the whole pitch.
Further Reading & References
- Laravel Reverb — official documentation (installation, SSL, production tuning, scaling)
- Laravel Broadcasting — official documentation (events, channel authorisation, Echo setup, model broadcasting)
- Laravel Reverb — current documentation mirror
- Running Laravel Reverb — Web Coding Center (server/client split, scaling notes, hosted-service price table)
- Laravel Reverb: The Complete Guide to Real-Time WebSockets (2026) — Redberry
- Real-Time Laravel: Why WebSockets Beat Polling Every Time — SaasyKit
- Build a Laravel Project Management Tool (Kanban + Realtime) — Laracopilot (Reverb in a real Kanban board)
- Pusher Channels pricing — pusher.com (Sandbox and Startup limits quoted in the cost table, checked 28 October 2026)
Facts verified 28 October 2026 against Laravel’s official Reverb and Broadcasting documentation and Pusher’s published pricing.



