Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Divyes's avatar
Level 1

Error Broadcasting Event to Reverb in Laravel on VPS Hosting

I have successfully hosted my Laravel application on a VPS running Ubuntu. The app is up and running, and WebSocket connections are working fine. However, when I try to broadcast an event to Reverb, I encounter an error. The socket connection is established, but broadcasting fails with an error.

Here’s a summary of my setup:

<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/html/example/public

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem

    <Directory /var/www/html/example/public>
        AllowOverride All
        Require all granted
    </Directory>

    ProxyPreserveHost On
    ProxyPass /app ws://127.0.0.1:8080/app
    ProxyPassReverse /app ws://127.0.0.1:8080/app

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Reverb .env Configuration:

BROADCAST_CONNECTION=reverb

REVERB_APP_ID=******
REVERB_APP_KEY=*******
REVERB_APP_SECRET=*******
REVERB_HOST=example.com
REVERB_PORT=443
REVERB_SCHEME=https

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

Supervisor Setup: The supervisor is running the reverb:start command in the background, and the log shows:

INFO  Starting server on 0.0.0.0:8080 (example.com).
Pruning Stale Connections ..................................................

Issue:

  • The WebSocket connection to Reverb is successfully established.
  • However, when broadcasting the event using:
Broadcast::presence("room." . $this->code)->sendNow();

It results in the following error:

Internal Server Error

Illuminate\Broadcasting\BroadcastException
Pusher error: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Not Found</title> <style> ......

The error points to a 404 Not Found issue, indicating that the request is not properly handled by the WebSocket server.


Has anyone encountered this issue, or does anyone have suggestions on how to troubleshoot or fix broadcasting errors with Reverb in a Laravel app hosted on a VPS?

0 likes
1 reply

Please or to participate in this conversation.