Skip to main content
The WebSocket Service provides endpoints for establishing persistent connections between clients and the server, enabling real-time, bidirectional communication. This service is used for features that require instant updates and notifications.

Authentication

WebSocket connections require authentication via a valid JWT token provided as a query parameter.

Base URL

WebSocket Endpoints

Establish Connection

Create a persistent WebSocket connection.
When using HTTPS, use the wss:// protocol instead:
Query Parameters:

Message Format

Messages exchanged over the WebSocket connection are JSON-formatted with the following structure:

Client-to-Server Messages

Server-to-Client Messages

Message Types

Events

The WebSocket service broadcasts various events to connected clients:

Commands

Clients can send commands to the server:

Error Handling

The server may send error messages in the following format:
Common error codes:

Connection Example

JavaScript Client Example

Reconnection Strategy

It’s recommended to implement a reconnection strategy in your client application to handle unexpected disconnections:
  1. Start with a small delay (e.g., 1 second)
  2. Use exponential backoff with jitter to increase the delay between reconnection attempts
  3. Set a maximum retry limit or maximum delay
  4. Reset the delay when a successful connection is established

Security Considerations

  • WebSocket connections are authenticated using JWT tokens
  • Tokens should be kept secret and not shared
  • Connections will be terminated when tokens expire
  • The server may implement rate limiting to prevent abuse

Implementation Notes

  • The WebSocket service uses the standard WebSocket protocol (RFC 6455)
  • Messages are exchanged in JSON format
  • The service supports multiple concurrent connections
  • Channel subscriptions allow for efficient message filtering
  • Clients should handle reconnection logic on their side