Skip to main content
Documentation
StartOverviewArchitectureAuthenticationSend your first message
TypeScript SDKOverviewTrusted app serverApp-user clientsRealtimeErrors & webhooks
Flutter SDKOverviewInstallationAuthenticationChannels & messagesOffline & syncRealtimeUI componentsPush & lifecycle
ConceptsTenancy & scopeChannels & messagesDelivery & reconciliationSecurity checklist
ProtocolsRealtimeSigned webhooks
ReferenceREST APIErrors, limits & retriesDeploy docs to Coolify
VV ChatDocs API v1
Recommended starting points
Build chat without rebuilding infrastructureV Chat is a multi-tenant messaging backend with typed server, web, and Flutter integration paths.StartArchitecture at a glanceUnderstand the control plane, data plane, realtime path, and SDK boundaries before integrating.StartAuthentication and credentialsSelect the correct credential for dashboard, trusted-server, app-user, realtime, and webhook flows.StartSend your first messageUse the trusted TypeScript server client to create the minimum safe messaging flow.StartTypeScript SDK overviewChoose the correct typed client for trusted servers, app users, dashboard sessions, realtime, and webhooks.TypeScript SDKTrusted app-server clientUse AppServerClient from a protected backend to manage data-plane resources and mint app-user tokens.TypeScript SDKApp-user clientsBuild browser or Node app-user flows with VChatClient or the lower-level AppUserClient.TypeScript SDK
↑↓ Navigate↵ Openesc Close
API reference
StartOverviewArchitectureAuthenticationSend your first message
TypeScript SDKOverviewTrusted app serverApp-user clientsRealtimeErrors & webhooks
Flutter SDKOverviewInstallationAuthenticationChannels & messagesOffline & syncRealtimeUI componentsPush & lifecycle
ConceptsTenancy & scopeChannels & messagesDelivery & reconciliationSecurity checklist
ProtocolsRealtimeSigned webhooks
ReferenceREST APIErrors, limits & retriesDeploy docs to Coolify
Contract sourceOpenAPI JSON
Docs/TypeScript SDK
WebSocket v1

TypeScript realtime

Connect, subscribe, consume ordered durable events, and recover safely after gaps or reconnects.

Updated 2026-08-09•packages/sdk-typescript/src/realtime · docs/realtime/v1

Connect and subscribe

ts
const connection = await appUser.realtime.connect({
  webSocketFactory: (url, protocols) =>
    new WebSocket(url, [...protocols]),
});

const subscription = await connection.channels.subscribe({
  channelTypeKey: 'messaging',
  channelId: 'support-123',
});

const stop = subscription.onEvent((event) => {
  renderChannelEvent(event);
});

stop();
connection.close();

The connection obtains a one-use ticket, negotiates only vchat.realtime.v1, and is ready only after the strict connection.ready envelope. The subscription is authorized independently and starts from the server-acknowledged event baseline.

Delivery and sequence

  • Delivery is at-least-once. Deduplicate by eventId.
  • Track subscription.lastEventSequence for the accepted channel position.
  • The SDK bounds in-memory deduplication; it does not persist exactly-once state.
  • A refresh_required or stale subscription requires authoritative REST refresh before local continuity can be trusted.
  • Compatible unknown future v1 event names are ignored safely while known ordering gaps trigger recovery.

Private user state

ts
const stopPrivate = connection.onUserMessagingState((update) => {
  if (update.conversation.changed) {
    renderConversation(update.conversation.value);
  }
  if (update.unreadSummary.changed) {
    renderUnread(update.unreadSummary.value);
  }
});

Private conversation, unread, and thread state is visible only to the authenticated app user and uses independent version fences.

Presence and typing

An active channel subscription exposes connection-local presence and typing controllers. Presence watches exact bounded user IDs. Typing is scoped to the channel or a one-depth thread. Both are ephemeral and cleared on disconnect; neither is persisted or replayed as durable history.

PreviousApp-user clientsNext Errors and signed webhooks
On this pageConnect and subscribeDelivery and sequencePrivate user statePresence and typing
Report a docs issue