2.7 KiB
2.7 KiB
Realtime Messaging
Skinbase Nova messaging now uses Laravel Reverb, Laravel Broadcasting, Laravel Echo, Redis-backed queues, and Laravel Horizon for queue visibility.
v2 capabilities
- Presence is exposed through a global
presence-messagingchannel for inbox-level online state. - Conversation presence still uses the per-thread presence channel so the header can show who is actively viewing the room.
- Typing indicators remain ephemeral and Redis-backed.
- Read markers are stored on conversation participants and expanded into
message_readsfor durable receipts. - The conversation list response now includes
summary.unread_totalfor global badge consumers. - Reconnect recovery uses
GET /api/messages/{conversation_id}/delta?after_message_id=.... - Presence heartbeats use
POST /api/messages/presence/heartbeatand are intended only to support offline fallback notification logic plus server-side presence awareness.
Local setup
- Set the Reverb, Redis, messaging, and Horizon values in
.env. - Run
php artisan migrate. - Run
npm installif dependencies are not installed. - Start the websocket server with
php artisan reverb:start --host=0.0.0.0 --port=8080. - Start queue workers with
php artisan queue:work redis --queue=broadcasts,notifications,default --tries=1. - Start the frontend with
npm run devor build assets withnpm run build.
Horizon
- Horizon is installed for production queue monitoring and uses dedicated supervisors for
broadcastsandnotificationsalongside the default queue. - The scheduler now runs
php artisan horizon:snapshotevery five minutes so the dashboard records queue metrics. - On Windows development machines, Horizon itself cannot run because PHP lacks
ext-pcntlandext-posix; that limitation does not affect Linux production deployments. - Use
php artisan horizonon Linux-based environments and keep the dashboard behind theviewHorizongate.
Production notes
- Use
BROADCAST_CONNECTION=reverbandQUEUE_CONNECTION=redis. - Keep
MESSAGING_REALTIME=trueonly when Reverb is configured and reachable from the browser. - Terminate TLS in Nginx and proxy websocket traffic to the Reverb process.
- Run
php artisan reverb:startandphp artisan horizonunder Supervisor or systemd. - The chat UI falls back to HTTP polling only when realtime is disabled in config.
- Database notification fallback now only runs for recipients who are not marked online in messaging presence.
Reconnect model
- The conversation view loads once via HTTP.
- Live message, read, typing, and conversation summary updates arrive over websocket channels.
- When the socket reconnects, the client requests deltas from the explicit
deltaendpoint and merges them idempotently by message id, UUID, and client temp id.