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

# Server messages

> The JSON messages you receive on a streaming connection.

All server messages are JSON text frames with a `type` field.

## `session`

*First message on every connection*

```json theme={null}
{"type":"session","session_id":"ps_8cad4b97686c1cffa2f9ac834c48b7e4","resumed":false,"diarizer":"kombucha-1"}
```

`resumed` is `true` when you attached to an existing session. `diarizer` names the model that labels the speakers. Start sending audio after this message: on a new session, live audio from now on; on a resumed one, the audio you buffered while disconnected first.

## `speakers`

*Live updates*

```json theme={null}
{"type":"speakers","seq":42,
 "segments":[{"start_ms":31200,"end_ms":36400,"speaker":"1"}],
 "open":{"start_ms":36700,"end_ms":39900,"speaker":"0"},
 "final_until_ms":40100}
```

| Field | Meaning |
| - | - |
| `segments` | Segments that closed since the previous message on this connection (may be empty). Closed segments are final and never change. |
| `open` | The speaker turn still in progress, or `null`. Its `start_ms` and `speaker` never change; only `end_ms` grows. It later closes into a segment with the same `start_ms` and `speaker`. |
| `seq` | Total number of closed segments so far. Each message adds `segments.length` to the previous `seq`. |
| `final_until_ms` | Audio time up to which speakers are decided. Everything before it is reflected in `segments` and `open`. |

Messages arrive when a segment closes, and about once per second while the open turn grows. During silence there may be no messages at all.

## `speakers_snapshot`

*After reconnecting*

Same fields as `speakers`, but `segments` holds every closed segment since the start of the session. Sent right after `session` when you reconnect to a session that already has segments.

## `final`

*The complete result*

```json theme={null}
{"type":"final","segments":[{"start_ms":200,"end_ms":5400,"speaker":"0"}, …],"speakers":3,"reason":"finalized"}
```

`segments` lists every segment of the session from the start: the ones already sent live, followed by the rest. `speakers` is the number of distinct speakers. `reason` says [why the session ended](https://docs.meetjamie.ai/platform/errors.md#end-reasons).

## `finished`

*Last message*

```json theme={null}
{"type":"finished"}
```

Follows `final`; the server then closes the socket.

## `error`

*Problems with your stream*

```json theme={null}
{"type":"error","code":"frame_too_large","message":"an audio frame may hold at most 16000 bytes (500 ms), this one held 20000"}
```

See [stream errors](https://docs.meetjamie.ai/platform/errors.md#stream-errors) for all codes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.