Realtime Stream Handling
YouruseNotificationStream hook connects to /realtime/notifications and supports:
- Channel filters
- Organization/workspace scoping
- Exponential reconnect
- Ping keepalive
Implementation details from your hook
- Builds websocket URL from
deployment.backend_host. - Uses
wssforhttpsdeployments. - Sends ping every 30s.
- Reconnects with exponential backoff.
Integration pattern
Use stream for freshness, but keep inbox API as source of truth.Production guidance
- Always tolerate temporary disconnects.
- Reconcile state from API after reconnect.
- Track connection error metrics.
- Avoid duplicate append on stream + poll overlap.
Related docs
- React Router
useNotificationStream - React Router
useNotifications - Frontend API Notifications Reference
Go-live checklist
- Scope and severity conventions are documented.
- Inbox read/archive/star flows are tested.
- Realtime reconnection behavior is verified.
- Noisy template monitoring is in place.
- Expiry strategy is applied for stale notifications.
