Skip to content
alzafchat / Developers

Documentation / Reference

Realtime

Private channels, events and reconnect behavior.

API & technical reference

Thread channel: Laravel Echo private chat.service.{serviceId}.conversation.{conversationId} (wire name has private- prefix). Inbox channel: private chat.service.{serviceId}.inbox.{identityId} (owner-only: identity id and service must match). Provider channel: private chat.service.{serviceId}.provider.{providerId} (matching seller or any service admin). Derive IDs from authenticated API results. Subscribe with bearer authentication to example /api/broadcasting/auth; host implementations must register their own authenticated broadcast endpoint and allow all three channel shapes. Other customer/provider/service subscriptions are denied using the same scope as REST.

Listen to custom Echo events (dot disables namespace prefixing): .message.created on the thread channel with payload {message:Message}, matching the API message schema; .inbox.message {conversation_id,message} on each participant's inbox channel and on the conversation's provider channel, so same-shop sellers and service admins hear threads they have not joined yet (sender included; dedupe by message ID — a participant seller/admin receives both, and a selected thread receives both); .conversation.created {conversation} (creator-view DTO; other viewers hydrate via GET /conversations/{id} and never insert the payload) on the provider channel; .conversation.status {id,status} on each participant's inbox channel and on the provider channel. Events carry the complete message DTO, including attachments with their signed URLs, so no separate attachment event exists; an attachment URL that has expired by the time a client renders an old event is refreshed by fetching history. The event contains no browser-trusted identity. Reverb app key is public; app secret stays server-side.

Messages are persisted inside transactions; ShouldDispatchAfterCommit dispatches queued broadcasting after commit. Run php artisan queue:work --tries=3 alongside Reverb. Queue/broadcast failure cannot roll back a committed message. Failed jobs need operator attention; missed events are recovered via REST. The first release has no durable outbox and cannot guarantee notification delivery across a crash between commit and event enqueue.

Events can arrive late, duplicate or out of order. Merge by numeric message ID, never append without deduplication. After subscription and reconnect, fetch messages with after_id equal to the last known ID and follow pages until has_more=false. The SDK must also reconcile after initial subscription to cover the fetch/subscribe race. The SDK subscribes the inbox channel once per identity and refreshes the full list on (re)subscription for gap safety; sellers additionally follow their own provider channel and service admins follow every provider in the service, so team inboxes stay live for threads they have not joined (customers follow none); unknown conversation IDs hydrate via GET /conversations/{id}. Without Reverb the SDK polls the list plus open-thread deltas every ~20s while the document is visible (default-on). REST persists even if realtime is offline.

Only message, conversation-created and status events exist. Admin joins, read updates and typing require inbox/API refresh; no typing/read event is implemented. The own central host guards existing subscriptions against token expiry/revocation and account/service/provider changes before delivering any payload and closes idle revoked sockets on a periodic check. See auth/management enforcement. This uses the shared central DB and pinned Reverb1.12 manager extension. Generic embedded hosts must implement their own post-subscription revocation policy; stock Reverb private auth only checks at subscription time. Multi-node guard behavior is not verified.