How broadcasting works
Broadcasting lets your server notify the browser the moment something happens — an order ships, a message arrives, a file finishes processing — without the browser polling for updates. The flow is:- Something happens on the server (a model updates, a job completes).
- Your code fires a Laravel event that implements
ShouldBroadcast. - Laravel queues a broadcast job and sends the event payload to a WebSocket server.
- The browser, connected to the same WebSocket server via Laravel Echo, receives the event and updates the UI.
Broadcasting is built on top of Laravel’s event system. Events and listeners are the foundation — broadcasting adds a delivery channel. Make sure you’re comfortable with events and listeners before continuing.
Setup
Broadcasting is disabled in new Laravel apps. Enable it with:config/broadcasting.php and routes/channels.php, and prompts you to choose a driver.
Before any events can be broadcast, you need a running queue worker. Broadcasting dispatches jobs asynchronously to avoid slowing down your HTTP responses.
Laravel Reverb
Reverb is Laravel’s official self-hosted WebSocket server, introduced in Laravel 11. It’s the recommended driver for most applications — no external service account required.Install Reverb
The quickest path installs everything at once:Environment variables
Start the Reverb server
Channel types
Creating a broadcast event
ShouldBroadcast on the generated class:
public properties are included in the broadcast payload. Limit the data with broadcastWith():
broadcastAs():
. in JavaScript to bypass Echo’s default namespace:
Authorizing private channels
Private and presence channels require a server-side authorization check before a client can subscribe. Define authorization callbacks inroutes/channels.php:
true (or any truthy value) to allow the subscription; return false to deny it. The first parameter is always the authenticated user; subsequent parameters match the wildcards in the channel name.
Route model binding in channels
Use the model type instead of an ID and Laravel resolves it automatically:Channel classes
When yourchannels.php grows, move authorization logic into dedicated classes:
routes/channels.php:
Firing broadcast events
Fire a broadcast event the same way you fire any other Laravel event:Receiving events with Laravel Echo
Install Echo and set up the client
resources/js/bootstrap.js:
Listening for events
React and Vue hooks
If you’re using a React or Vue starter kit, Echo ships composable hooks:End-to-end example: real-time order status
1
Enable broadcasting and start services
2
Create the broadcast event
3
Authorize the channel
4
Fire the event when the order changes
5
Listen for the event in the browser
Next steps
Laravel Reverb
Set up and operate the Reverb server: production configuration, Nginx proxying, Supervisor, and horizontal scaling with Redis.
Events and listeners
Broadcasting is built on Laravel’s event system. Learn how to create events and listeners.