> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kynasmith.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Realtime protocol

> Session lifecycle and message flow for direct API integrations.

# Realtime protocol

<Note>
  If you are using an official SDK, the SDK manages the realtime connection for you. This page is for developers integrating directly with the API without an SDK.
</Note>

After creating a detection session, connect to the WebSocket using the `stream_url` and `runtime_token` returned in the session creation response.

## Message types

**Client to server:**

* `frame_batch` — Send pose frame data
* `finalize` — Signal that you have sent the last frame
* `cancel` — Cancel the session

**Server to client:**

* `frame_ack` — Confirms which frames were accepted
* `event_batch` — Detection events (e.g., movement detected)
* `session_update` — Session status changes
* `session_done` — Session has reached a terminal state

## Session completion

Send `finalize` when you have submitted the last pose frame. Continue reading messages until you receive `session_done`, which contains the final session result.

## Reconnect

If your connection drops, you can reconnect to the same session using the original `stream_url` and `runtime_token`. Cross-session resume is not supported.
