The WebSocket transport streams chat over a persistent connection. It’s the SDK’s default (transport: "auto"), with automatic SSE fallback.

Connect

Or with server credentials:

Client → server

Send a chat frame:

Server → client

Token frames stream, then a terminal frame:
Errors:

Connection behavior

  • One connection serves sequential chats — send the next chat frame after done.
  • The server sends pings every 30 seconds to keep the connection alive.
  • group_ids follows the same rules as HTTP: intersected with the key’s allowed_groups, narrowing only.

Minimal browser example

Use @beforequery/sdk instead of raw WebSocket where possible — it handles connection reuse, the 5-second connect timeout, and automatic SSE fallback for you.