Skip to content

AtloriaWebSocketClient

reference
1 min readUpdated

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

MethodSignatureReturns
setToken`setToken(token: stringnull)`
joinDocumentjoinDocument(documentId: string, namespace: NamespaceType)void
leaveDocumentleaveDocument(documentId: string, namespace: NamespaceType)void
subscribesubscribe(channel: string, handler: SubscriptionHandler)() => void
onon(event: string, handler: SubscriptionHandler)void
offoff(event: string, handler: SubscriptionHandler)void
emitemit(event: string, data: any)void
disconnectdisconnect()void
isConnectedisConnected()boolean

Where it refuses work

  • AtloriaWebSocketClient stops the work with an early return when existingSocket?.connected.
  • AtloriaWebSocketClient stops the work with an early return when this.reconnecting.

When something fails

  • AtloriaWebSocketClient handles failure in 1 place: it logs it and continues in all 1.

Was this page helpful?

Download as PDF