Bird

Build a live order-status view

Keep the order in your database and use Realtime to tell connected clients when it changes. This pattern lets the page recover after a missed event or disconnected session.

1. Load the current order

Serve the order through your application's authenticated endpoint. Authorize the signed-in customer before returning its status and version. The page should display this result even if the realtime connection is temporarily unavailable.

2. Subscribe to an authorized channel

Use a private channel for customer-specific data and implement channel authorization on your server. An app key identifies the Realtime app; it does not grant a customer access to an order.
The first-event quickstart contains the complete browser and server setup. Replace its public demo channel with the authorized private channel for your application before sending personal data.

3. Publish after the database change

After the order update commits, publish an event identifying the changed order and its application version. Use the supported SDK call from publishing events.
Keep publication outside the customer's browser. If your application needs publication to survive a server restart, record pending publications alongside the database change and let a worker retry them. That application record is separate from Realtime transport.

4. Refresh the view

Treat the event as a reason to load current order state. Ignore an event older than the version already displayed. Fetching the current record also avoids presenting an event payload as the final business state when another update has already occurred.
Register the event handler before the first publication you expect to receive. After subscription succeeds, refresh once to cover a change that occurred between the initial fetch and subscription.

5. Recover after disconnects

On reconnection, load the current order again. Re-establishing a subscription does not replay every event missed while the client was disconnected. Follow connection lifecycle and display a useful connection state.
Test by disconnecting the client, updating the order and reconnecting. The page should show the current order without depending on a missed event.
Run the complete Express and browser order example, including private authorization, presence and recovery after a disconnect.

Related resources

Continue with the documentation, guides and examples for this topic. Resources are in English.

Try the practice and get an implementation brief