Skip to content

Interface: RealtimeSession

Defined in: packages/aiui-claude-channel/src/realtime.ts:237

A live per-thread realtime transcription session. Audio streams in by segment ordinal; deltas/finals come back through the RealtimeCallbacks.

Methods

appendAudio()

appendAudio(segment, bytes): void

Defined in: packages/aiui-claude-channel/src/realtime.ts:239

Append one PCM16 frame of segment (base64-encoded and forwarded upstream).

Parameters

segment

number

bytes

Uint8Array

Returns

void


close()

close(): void

Defined in: packages/aiui-claude-channel/src/realtime.ts:257

Close the upstream socket (idempotent).

Returns

void


commit()

commit(segment): void

Defined in: packages/aiui-claude-channel/src/realtime.ts:241

Commit segment (talk-end): its buffer is transcribed as one item.

Parameters

segment

number

Returns

void


discard()

discard(segment): void

Defined in: packages/aiui-claude-channel/src/realtime.ts:248

Drop segment without transcribing it — an accidental tap whose buffer is under the upstream's 100 ms commit minimum. Clears the upstream input buffer (so the stray frames can't prepend to the next segment) and unbinds anything a pre-commit delta may have bound to it.

Parameters

segment

number

Returns

void


drain()

drain(timeoutMs): Promise<number[]>

Defined in: packages/aiui-claude-channel/src/realtime.ts:255

Resolve once every committed-but-not-completed segment has produced its final, or timeoutMs elapses — whichever first. Returns the ordinals still outstanding at timeout (so the caller can finalize them loudly). Used at fin, where the compose needs the transcripts that are still in flight.

Parameters

timeoutMs

number

Returns

Promise<number[]>