Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Laravel Echo connects to Reverb but no events arrive

ErrorEcho connects but the listener callback never runs

Short answer

Reverb events fail to arrive for four common reasons: no queue worker is running, BROADCAST_CONNECTION is not reverb, the Echo client points at the wrong host or port, or a custom broadcastAs name is listened for without a leading dot. Check them in that order.

  • Applies to Laravel 12, Reverb, laravel-echo, pusher-js, nginx 1.26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run Reverb with debug output and trigger the event. If Reverb prints nothing, the message never leaves Laravel.

    php artisan reverb:start --debug
  2. 2Match what you see, then jump to its fix

    1. 1Reverb debug shows connections but no messages when the event firesNo queue worker is runningFix
    2. 2Nothing at all appears in Reverb debug, and no job is queuedThe broadcaster is not set to reverbFix
    3. 3Console shows ws://localhost:80 failing, or a Pusher connection errorThe Echo client points at the wrong host, port or schemeFix
    4. 4Other events arrive, only the one with broadcastAs does notA custom event name is listened for without a leading dotFix

What does the error look like?

  • Echo connects but the listener callback never runs
  • WebSocket connection to 'ws://localhost:80/app/...' failed
  • Pusher error in the browser console

Cause 1 of 4

No queue worker is running

1Check

Broadcasting is done by queued jobs, so a worker must be running before any event is broadcast.

php artisan queue:work

2Fix

Run a worker, or implement ShouldBroadcastNow on the event so it uses the sync queue.

use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;

class OrderShipmentStatusUpdated implements ShouldBroadcastNow
{
    // ...
}

3Verify

Fire the event again and watch the Reverb debug output show the message.

php artisan reverb:start --debug

Confirmed by laravel.com

Did this fix it?

Cause 2 of 4

The broadcaster is not set to reverb

1Check

The driver comes from the BROADCAST_CONNECTION environment variable and the Reverb credentials from REVERB_APP_ID, REVERB_APP_KEY and REVERB_APP_SECRET.

grep -n "BROADCAST_CONNECTION\|REVERB_" .env

2Fix

Run the installer, which writes the right values, or set them by hand and clear the config cache.

php artisan install:broadcasting --reverb
php artisan config:clear

3Verify

The values are present and the server starts.

php artisan reverb:start

Confirmed by laravel.com

Did this fix it?

Cause 3 of 4

The Echo client points at the wrong host, port or scheme

1Check

Echo uses the reverb broadcaster with pusher-js and reads the VITE_REVERB values. The server's own REVERB_SERVER_HOST and REVERB_SERVER_PORT are different from REVERB_HOST and REVERB_PORT, which say where clients and Laravel reach Reverb. Behind a proxy the public port is usually 443.

grep -n "REVERB_" .env

2Fix

Set the public host and port the browser should use, then restart Reverb.

REVERB_SERVER_HOST=0.0.0.0
REVERB_SERVER_PORT=8080

REVERB_HOST=ws.example.com
REVERB_PORT=443

3Verify

The browser opens a socket to the public host with no error.

php artisan reverb:restart

Confirmed by laravel.com

Did this fix it?

Cause 4 of 4

A custom event name is listened for without a leading dot

1Check

Echo adds the application namespace to the name unless the listener name starts with a dot.

grep -rn "broadcastAs" app/Events/

2Fix

Register the listener with a leading dot.

Echo.channel('orders')
    .listen('.server.created', (e) => {
        console.log(e);
    });

3Verify

Fire the event and see the callback log.

php artisan tinker
# then, at the prompt: event(new App\Events\ServerCreated());

Confirmed by laravel.com

Did this fix it?

How do I stop it coming back?

  • Run Reverb and the queue worker under Supervisor or systemd so both restart on failure.
  • Restart Reverb with reverb:restart after code changes, since it is a long-running process.
  • Proxy the /app and /apps paths to Reverb, with the Upgrade headers.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

PHP stops the script after 30 seconds

Symfony\Component\ErrorHandler\Error\FatalError: Maximum execution time of 60 seconds exceeded

PHP ends a script that runs past max_execution_time (30 seconds by default for web requests).

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.