Kind: Class
Source: atloria-monorepo/apps/web/src/lib/websocket-client.ts
AtloriaWebSocketClient
Manages WebSocket connections for real-time updates. Supports multiple namespaces (comments, documents) and channel subscriptions.
Implements: WebSocketClient
Methods
| Method | Signature | Returns |
|---|---|---|
setToken | `setToken(token: string | null)` |
joinDocument | joinDocument(documentId: string, namespace: NamespaceType) | void |
leaveDocument | leaveDocument(documentId: string, namespace: NamespaceType) | void |
subscribe | subscribe(channel: string, handler: SubscriptionHandler) | () => void |
on | on(event: string, handler: SubscriptionHandler) | void |
off | off(event: string, handler: SubscriptionHandler) | void |
emit | emit(event: string, data: any) | void |
disconnect | disconnect() | void |
isConnected | isConnected() | boolean |
Where it refuses work
AtloriaWebSocketClientstops the work with an early return whenexistingSocket?.connected.AtloriaWebSocketClientstops the work with an early return whenthis.reconnecting.
When something fails
AtloriaWebSocketClienthandles failure in 1 place: it logs it and continues in all 1.
Was this page helpful?