Files
SkinbaseNova/docs/realtime-messaging.md

27 lines
1.3 KiB
Markdown

# Realtime Messaging
Skinbase Nova messaging now uses Laravel Reverb, Laravel Broadcasting, Laravel Echo, and Redis-backed queues.
## Local setup
1. Set the Reverb and Redis values in `.env`.
2. Run `php artisan migrate`.
3. Run `npm install` if dependencies are not installed.
4. Start the websocket server with `php artisan reverb:start --host=0.0.0.0 --port=8080`.
5. Start queue workers with `php artisan queue:work redis --queue=broadcasts,default,notifications --tries=1`.
6. Start the frontend with `npm run dev` or build assets with `npm run build`.
## Production notes
- Use `BROADCAST_CONNECTION=reverb` and `QUEUE_CONNECTION=redis`.
- Keep `MESSAGING_REALTIME=true` only when Reverb is configured and reachable from the browser.
- Terminate TLS in Nginx and proxy websocket traffic to the Reverb process.
- Run both `php artisan reverb:start` and `php artisan queue:work redis --queue=broadcasts,default,notifications --tries=1` under Supervisor or systemd.
- The chat UI falls back to HTTP polling only when realtime is disabled in config.
## Reconnect model
- The conversation view loads once via HTTP.
- Live message, read, and typing updates arrive over websocket channels.
- When the socket reconnects, the client requests message deltas with `after_id` to merge missed messages idempotently.