This page describes a proposed business-event design, not the current API. Its ResourceUpdated, OrderStatusUpdated and application-level helpers are not implemented. Notification already implements ClientRefreshEvent and its queued debounce mechanism in the package. Use the broadcasting reference for actual channel names, payloads and delivery requirements. The examples below are proposals only.

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.
Channel: 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.
Channel: 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:
The helper function 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:
Start the Reverb server:

Channel authorization

Channel authorization is defined in routes/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 the client_refresh queue to avoid blocking the API response:
This ensures the API responds quickly while broadcasts happen in the background.

Event flow diagram