RealtimeTransportLayer
이 콘텐츠는 아직 번역되지 않았습니다.
The transport layer is the layer that handles the connection to the model and the communication with the model.
Extends
Section titled “Extends”EventEmitter<RealtimeTransportEventTypes>
Properties
Section titled “Properties”readonly muted: boolean | null;Whether the input audio track is currently muted null if the muting is not handled by the transport layer
status
Section titled “status”status: "connecting" | "connected" | "disconnected" | "disconnecting";Methods
Section titled “Methods”addImage()
Section titled “addImage()”addImage(image, options?): void;Sends an image to the model
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
The image to send |
|
|
{ |
Additional options |
|
|
|
Whether to trigger a response from the model |
Returns
Section titled “Returns”void
close()
Section titled “close()”close(): void;Closes the connection to the model
Returns
Section titled “Returns”void
connect()
Section titled “connect()”connect(options): Promise<void>;Establishes the connection to the model and keeps the connection alive
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The options for the connection |
Returns
Section titled “Returns”Promise<void>
emit()
Section titled “emit()”emit<K>(type, ...args): boolean;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
… |
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”EventEmitter.emitinterrupt()
Section titled “interrupt()”interrupt(): void;Interrupts the current turn. Used for example when a guardrail is triggered
Returns
Section titled “Returns”void
mute()
Section titled “mute()”mute(muted): void;Mutes the input audio track
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
Whether to mute the input audio track |
Returns
Section titled “Returns”void
off<K>(type, listener): EventEmitter<RealtimeTransportEventTypes>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
(… |
Returns
Section titled “Returns”EventEmitter<RealtimeTransportEventTypes>
Inherited from
Section titled “Inherited from”EventEmitter.offon<K>(type, listener): EventEmitter<RealtimeTransportEventTypes>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
(… |
Returns
Section titled “Returns”EventEmitter<RealtimeTransportEventTypes>
Inherited from
Section titled “Inherited from”EventEmitter.ononce()
Section titled “once()”once<K>(type, listener): EventEmitter<RealtimeTransportEventTypes>;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
(… |
Returns
Section titled “Returns”EventEmitter<RealtimeTransportEventTypes>
Inherited from
Section titled “Inherited from”EventEmitter.onceresetHistory()
Section titled “resetHistory()”resetHistory(oldHistory, newHistory): void;Resets the conversation history / context to a specific state
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The history that is currently stored on the session. |
|
|
|
The history you want the session to use going forward. |
Returns
Section titled “Returns”void
sendAudio()
Section titled “sendAudio()”sendAudio(audio, options): void;Sends a raw audio buffer to the model
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
The audio buffer to send |
|
|
{ |
Additional options |
|
|
|
Whether to commit the audio buffer to the model. If the model does not do turn detection, this can be used to indicate the turn is completed. |
Returns
Section titled “Returns”void
sendEvent()
Section titled “sendEvent()”sendEvent(event): void;Sends a raw event to the model
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The event to send |
Returns
Section titled “Returns”void
sendFunctionCallOutput()
Section titled “sendFunctionCallOutput()”sendFunctionCallOutput( toolCall, output, startResponse): void;Sends a function call output to the model
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
The tool call to send |
|
|
|
|
The output of the tool call |
|
|
|
‐ |
Returns
Section titled “Returns”void
sendMcpResponse()
Section titled “sendMcpResponse()”sendMcpResponse(approvalRequest, approved): void;Sends a response for an MCP tool call
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
{ |
The approval request to respond to |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
Whether the tool call was approved or rejected |
Returns
Section titled “Returns”void
sendMessage()
Section titled “sendMessage()”sendMessage( message, otherEventData, options?): void;Sends a text message to the model
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
The message to send |
|
|
|
Additional event data, will be merged into the event |
|
|
{ |
Additional options |
|
|
|
Whether to trigger a response from the model |
Returns
Section titled “Returns”void
updateSessionConfig()
Section titled “updateSessionConfig()”updateSessionConfig(config): void;Sends an updated session configuration to the model. Used to update for example the model instructions during a handoff
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
The new session config |
Returns
Section titled “Returns”void