Laravel Reverb Setup

⌘K
  1. Home
  2. Docs
  3. Botmerze – AI Support &#0...
  4. Instruction
  5. Laravel Reverb Setup

Laravel Reverb Setup

BotMerze ships Laravel Reverb preconfigured as a broadcasting driver (core/config/reverb.php and core/config/broadcasting.php are already in place — no install step required). Pusher is also supported and selectable from Admin Panel → Chatbot & AI Settings → Pusher / Reverb Settings.

✅ No php artisan reverb:install needed — the package is already wired into BotMerze. You only need to configure from admin panel or manually core/.env and run the server.

1. Configure core/.env

# Broadcasting
BROADCAST_DRIVER=reverb

# Reverb — what the browser connects to (HTTPS via your domain)
REVERB_APP_ID=botmerze
REVERB_APP_KEY=replace-with-random-key
REVERB_APP_SECRET=replace-with-random-secret
REVERB_HOST="yourdomain.com"
REVERB_PORT=443
REVERB_SCHEME=https

# Reverb — what the artisan server binds locally
REVERB_SERVER_HOST=0.0.0.0
REVERB_SERVER_PORT=8080

# Front-end (Vite) — picked up by the chatbot widget
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

💡 Generate strong random values for REVERB_APP_KEY / REVERB_APP_SECRET — e.g. openssl rand -hex 16. Keep REVERB_APP_ID short (alphanumeric).

2. Run Reverb

Manually (debugging only):

php /home/<domain>/public_html/core/artisan reverb:start --host=0.0.0.0 --port=8080

Production: run it under Supervisor — the botmerze-reverb program in Supervisor Configuration keeps it alive across crashes and reboots.

3. Reverse-proxy Reverb through Nginx (HTTPS on 443)

Inside your BotMerze server block, add a /app location that upgrades to WebSocket and forwards to local port 8080:

# Laravel Reverb WebSocket endpoint
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_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 60m;
    proxy_send_timeout 60m;
}

# Reverb auth/HTTP API endpoint (used for private/presence channels)
location /apps {
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Apply:

sudo nginx -t && sudo systemctl reload nginx

4. Apache reverse-proxy alternative

<IfModule mod_proxy.c>
    ProxyPreserveHost On
    ProxyPass        /app  ws://127.0.0.1:8080/app
    ProxyPassReverse /app  ws://127.0.0.1:8080/app
    ProxyPass        /apps http://127.0.0.1:8080/apps
    ProxyPassReverse /apps http://127.0.0.1:8080/apps
</IfModule>

Enable the modules first:

sudo a2enmod proxy proxy_http proxy_wstunnel
sudo systemctl reload apache2

5. Verify

# Reverb is listening locally
sudo ss -tlnp | grep 8080

# WebSocket handshake reaches Reverb through your domain
curl -I https://yourdomain.com/app
# Expect HTTP/1.1 101 Switching Protocols (or a Reverb-provided 4xx/upgrade response)

In the browser dev tools you should see a successful wss://yourdomain.com/app/<key> connection when you open a chatbot session.

Was this article helpful to you? No Yes

How can we help?