Overview
The WebSocket endpoint provides real-time notification delivery to connected clients. This connection-oriented approach minimizes latency and enables immediate user awareness of pending decisions.Connection
Endpoint:WS /api/v1/client/stream
Authentication: Requires Bearer token using user credentials
Connection Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
token | string | Yes | User authentication token (alternative to Authorization header) |
client_id | string | No | Client identifier for correlation (UUID recommended) |
version | string | No | Protocol version for compatibility (defaults to latest) |
Connection Example
Message Types
Notification Event
When a new notification is available for the user, the server sends a notification event:Status Update Event
When a notification’s status changes (e.g., it becomes invalidated), the server sends a status update event:Heartbeat Event
The server sends periodic heartbeat events to keep the connection alive:Error Event
When an error occurs that affects the WebSocket connection, the server may send an error event:Client Operations
Acknowledge Notification
Clients can acknowledge receipt of a notification to update its status toacknowledged
:
Respond to Notification
While clients can respond to notifications via the WebSocket connection, it is recommended to use the Submit Response REST endpoint for better error handling and retry capabilities.Reconnection Strategy
WebSocket connections may occasionally disconnect due to network issues, server maintenance, or other factors. Clients should implement a robust reconnection strategy with exponential backoff:Limitations
- Maximum of 5 concurrent WebSocket connections per user
- Heartbeat interval: 30 seconds
- Connection timeout: 60 seconds of inactivity
- Maximum message size: 1MB
Best Practices
- Implement Heartbeat: Always respond to heartbeat messages to keep the connection alive
- Handle Reconnection: Implement exponential backoff for reconnection attempts
- Manage Connection State: Keep track of connection state and avoid duplicate connections
- Fallback Strategy: Have a REST polling fallback for environments where WebSockets are not supported
- Efficient Rendering: Process and render notifications incrementally for large payloads
- Rate Limiting Awareness: Be mindful of connection attempt rate limits