Skip to content

Realtime inbox (optional) ​

The inbox always works. By default, on shared hosting, it polls: every few seconds the open inbox asks the server what changed. You can set the interval under Administration → Settings → Inbox polling interval.

On a VPS you can switch to websockets. Then new messages, delivery ticks, notes and assignments appear instantly, and the inbox only polls once a minute as a safety net. You have two options:

OptionWhere it runsCostNeeds
Laravel ReverbOn your own serverFreeA VPS with SSH, Supervisor (or systemd) and a web server you can configure
Pusher ChannelsPusher's cloudFree tier, then paidOnly a Pusher account; also works on some shared hosts

Nothing else in Desorix changes, and you can switch back to polling at any time by setting BROADCAST_CONNECTION=log.

How it works ​

When a conversation changes, Desorix sends a small event on a private channel for that phone number: inbox.number.{id}. The event says only which conversation changed. It never carries message text. The browser then reloads the changed data through the normal, permission-checked page request. A channel only accepts members who are allowed to use that number, so agents limited to certain numbers never receive events for other numbers.

Laravel Reverb on a VPS ​

1. Settings in .env ​

ini
BROADCAST_CONNECTION=reverb

REVERB_APP_ID=desorix
REVERB_APP_KEY=make-a-random-string
REVERB_APP_SECRET=make-another-random-string

# Where Desorix sends events to Reverb (server side, usually local).
REVERB_HOST=127.0.0.1
REVERB_PORT=8080
REVERB_SCHEME=http

# Where browsers connect (your domain, through the web server). Defaults to
# the site's own host on 443/https if left empty.
REVERB_PUBLIC_HOST=chat.example.com
REVERB_PUBLIC_PORT=443
REVERB_PUBLIC_SCHEME=https

Then run php artisan optimize.

Use long random values for the key and secret, e.g. openssl rand -hex 20. The key is public (browsers see it); the secret is not.

2. Keep Reverb running ​

Supervisor example (/etc/supervisor/conf.d/desorix-reverb.conf):

ini
[program:desorix-reverb]
command=php /var/www/desorix/artisan reverb:start --host=127.0.0.1 --port=8080
user=www-data
autostart=true
autorestart=true
stopwaitsecs=10
stdout_logfile=/var/www/desorix/storage/logs/reverb.log

Run supervisorctl reread && supervisorctl update. After each update of Desorix, restart it with supervisorctl restart desorix-reverb.

3. Send websocket traffic to Reverb ​

Browsers connect to wss://chat.example.com/app/{key}. Nginx example, inside the site's server { } block:

nginx
location /app/ {
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_read_timeout 60s;
    proxy_pass http://127.0.0.1:8080;
}

Reload nginx. On Apache, enable mod_proxy_wstunnel and proxy /app/ to ws://127.0.0.1:8080/app/.

4. Check it ​

Open the inbox with the browser's developer tools on the Network → WS tab. You should see one connection to /app/… that stays open. Send your business number a WhatsApp message: it appears straight away.

Pusher ​

ini
BROADCAST_CONNECTION=pusher
PUSHER_APP_ID=...
PUSHER_APP_KEY=...
PUSHER_APP_SECRET=...
PUSHER_APP_CLUSTER=eu

Run php artisan optimize. No server process or proxy is needed. Your server must be allowed to make outgoing HTTPS requests to Pusher.

If realtime stops working ​

The inbox keeps polling once a minute even with websockets on, so nothing is lost. It just isn't instant. Check that Reverb is running (supervisorctl status), that /app/ is proxied, and storage/logs/laravel.log for broadcast errors. Desorix reports broadcast failures but never lets them block message processing.