Overview
Exowpee plans to use Laravel’s event system combined with Reverb WebSockets to push real-time updates to connected clients. When a product is updated, an order status changes, or stock levels shift, connected clients would receive instant notifications.Events
ClientRefresh
File:app/Events/ClientRefresh.php
Broadcasts a general refresh signal to all clients connected to a company’s channel. Used when a broad UI refresh is needed.
private-company.{companyId}
Payload:
ResourceUpdated
File:app/Events/ResourceUpdated.php
Broadcasts when specific resources change (products, variations, stocks). Supports optional filtering by user profile so the user who made the change doesn’t receive their own update.
private-company.{companyId}
Payload:
OrderStatusUpdated
File:app/Events/OrderStatusUpdated.php
Broadcasts when an order’s status changes (e.g., pending to completed).
Broadcast debouncing
File:app/Services/BroadcastDebouncer.php
When multiple updates happen in quick succession (e.g., bulk stock import), broadcasting every change would flood clients. The BroadcastDebouncer batches updates using the cache:
broadcastResourceUpdate() in app/Helpers/helpers.php wraps this pattern for easy use.
WebSocket setup (Reverb)
Exowpee uses Laravel Reverb as the WebSocket server.Server-side configuration
In.env:
Channel authorization
Channel authorization is defined inroutes/channels.php. Private channels require the user to be authenticated and belong to the company:
Client-side connection
Connect to the WebSocket from your frontend:Queued events
Events are dispatched to theclient_refresh queue to avoid blocking the API response: