# Use WebSocket clients

Source: https://usecns.dev/cortex-topic-use-websocket-clients/

[Start here](https://usecns.dev/manual-cortex/)
[CLI commands](https://usecns.dev/commands-cortex/)
[Configuration & integration](https://usecns.dev/cortex-topics/)

The durable `/ws` endpoint accepts query `seatId`, `conversationId`, `sinceEntryId` plus authentication. Missing conversation uses the selected seat's root (unlike the CLI's fixed default 1). JSON commands accept optional correlation `id`, `seatId`, `conversationId`:

| `type` | Additional fields → reply |
| --- | --- |
| `subscribe` | `seatId`, optional `conversationId`, `sinceEntryId` → `initial_snapshot`, then optional `command_ack` if `id` supplied. Replaces previous subscription. |
| `submit` | `content`, optional `whenBusy`, `requestId` → `command_ack` with `submissionId`; not a settlement wait. |
| `abort` | Optional `taskId`, `submissionId` → `command_ack` with cancellation result. |
| `configure` | `patch` (same runtime patch as HTTP) → `command_ack` with `snapshot`. |
| `fork` | Required `atEntryId`, optional `title`, `agent` → `command_ack` with fork `snapshot`; unlike HTTP/MCP this handler does not choose latest when omitted. |

Example send: `{"id":"inspect-branch","type":"subscribe","seatId":"example","conversationId":1,"sinceEntryId":27}`. Initial reply has `protocolVersion:1`, seat/conversation IDs, `eventSnapshot`, `conversationSnapshot`, `taskGraph`, and (when cursor supplied) `sinceEntryId`, `deltaEntries`. Live frames are `agent_events` with `events` and `task_graph` with `taskGraph`; global updates include `herdr_updated`, `identity_updated`, `switchboard_updated`. Retain durable entry IDs, not WebSocket frame counts. Bootstrap/replay draining is bounded to 50 pages of 200 entries; use paginated entries for larger histories.

Command failure: `{"type":"command_error","id":"request-id","error":"…"}`. Initial subscription failure sends `type:"error"` then closes. Malformed JSON is ignored, and unrecognized command types have no guaranteed acknowledgement. Viewers can subscribe but cannot mutate; invalid/revoked credentials close with 4001. There is no request timeout protocol: clients must impose their own waits/recovery.

Browser voice `/ws/voice` accepts `seatId`, `conversationId`, `provider`. It consumes five input types: `audio` with base64 `audio`, `commit_audio`, `text` with `text`, `barge_in`, and `switch_provider` with `provider`, optional `modelId`, `voice`. Send 24 kHz PCM16 audio, not Twilio's μ-law frames. Replies: `session_ready` (session, seat/conversation, provider/model, audioFormat), `audio_delta` (`delta`, audioFormat, provider), `transcript_delta` (`delta`, `role`, provider), `barge_in_clear`, `tool_call` (`name`, `args`, `result`), `error` (`error`). Explicit barge-in cancels realtime audio; in the ElevenLabs bridge speech-start detection can also abort durable work. Do not assume all interruption paths have identical effects.

The six tools offered to the voice model are `get_durable_status` (no args), `read_transcript_recent` (`limit`, default 5), `submit_to_agent` (required `content`, optional `mode`), `configure_agent` (System 2 provider/model, thinking, System 1 backend, voice provider, optional `seatId` switch), `abort_agent` (optional task/submission IDs), and `fork_conversation` (optional entry/title, switches the active call to the fork). These are voice-provider tool schemas, not inbound MCP tools or additional `/ws` command types.