Defined in: realtime-types.ts
Connection interface representing an active realtime session. Handles audio I/O, events, and session management. Returned by RealtimeAdapter.connect().
disconnect(): Promise<void>;
Disconnect from the realtime session.
Promise<void>
startAudioCapture(): Promise<void>;
Start capturing audio from the microphone.
Promise<void>
stopAudioCapture(): void;
Stop capturing audio.
void
sendText(text): void;
Send a text message (fallback for when voice isn't available).
string
void
sendImage(imageData, mimeType): void;
Send an image to the conversation.
string
Base64-encoded image data or a URL.
string
MIME type of the image.
void
sendToolResult(callId, result): void;
Send a tool execution result back to the provider.
string
The tool call identifier.
string
JSON-serialized result.
void
updateSession(config): void;
Update session configuration.
Partial<RealtimeSessionConfig>
void
interrupt(): void;
Interrupt the current response.
void
on<TEvent>(event, handler): () => void;
Subscribe to connection events.
TEvent extends RealtimeEvent
TEvent
The event name ('status_change', 'mode_change', 'transcript', 'audio_chunk', 'tool_call', 'message_complete', 'interrupted', 'error').
RealtimeEventHandler<TEvent>
() => void
Unsubscribe function.
getAudioVisualization(): AudioVisualization;
Get audio visualization data for rendering level meters or waveforms.