Skip to content

bodhi-realtime-agent / ClientSenderAdapter

Class: ClientSenderAdapter ​

Defined in: src/transport/client-sender-adapter.ts:11

Adapts a SessionClientSender (e.g. multi-user WebSocket) to the IClientChannel interface expected by VoiceSession. Used when the server owns the client connection and feeds input explicitly via feedAudioFromClient / feedJsonFromClient.

Implements ​

Constructors ​

Constructor ​

new ClientSenderAdapter(sender, supportsPlaybackStateProtocol?): ClientSenderAdapter

Defined in: src/transport/client-sender-adapter.ts:20

Parameters ​

sender ​

SessionClientSender

supportsPlaybackStateProtocol? ​

boolean = false

Returns ​

ClientSenderAdapter

Properties ​

supportsPlaybackStateProtocol ​

readonly supportsPlaybackStateProtocol: boolean

Defined in: src/transport/client-sender-adapter.ts:18

Whether this channel participates in the playback-state protocol. Set by the channel producer (the factory) — not inferred here, since the adapter only sees a SessionClientSender and cannot tell PCM from avatar/RTC.

Implementation of ​

IClientChannel.supportsPlaybackStateProtocol

Methods ​

discardBuffered() ​

discardBuffered(): void

Defined in: src/transport/client-sender-adapter.ts:77

Leave buffering mode and drop the buffered assistant audio without sending it to the client (audio from an abandoned turn).

Returns ​

void

Implementation of ​

IClientChannel.discardBuffered


sendAudioToClient() ​

sendAudioToClient(data): void

Defined in: src/transport/client-sender-adapter.ts:34

Parameters ​

data ​

Buffer

Returns ​

void

Implementation of ​

IClientChannel.sendAudioToClient


sendJsonAfterAudio() ​

sendJsonAfterAudio(message): void

Defined in: src/transport/client-sender-adapter.ts:52

Playback-state protocol: deliver JSON in order after the turn's audio. The underlying sender writes audio and JSON to the one client socket in call order, so this is sendJsonToClient after the audio sends. During a reconnect-buffering window audio is buffered for replay while JSON would send immediately — sending audio.done then would let it overtake the buffered audio, so it is dropped and the turn falls to the fallback.

Parameters ​

message ​

AnyServerToClientMessage

Returns ​

void

Implementation of ​

IClientChannel.sendJsonAfterAudio


sendJsonToClient() ​

sendJsonToClient(message): void

Defined in: src/transport/client-sender-adapter.ts:42

Parameters ​

message ​

AnyServerToClientMessage

Returns ​

void

Implementation of ​

IClientChannel.sendJsonToClient


start() ​

start(): Promise<void>

Defined in: src/transport/client-sender-adapter.ts:25

Returns ​

Promise<void>

Implementation of ​

IClientChannel.start


startBuffering() ​

startBuffering(): void

Defined in: src/transport/client-sender-adapter.ts:57

Returns ​

void

Implementation of ​

IClientChannel.startBuffering


stop() ​

stop(): Promise<void>

Defined in: src/transport/client-sender-adapter.ts:29

Returns ​

Promise<void>

Implementation of ​

IClientChannel.stop


stopBuffering() ​

stopBuffering(): Buffer<ArrayBufferLike>[]

Defined in: src/transport/client-sender-adapter.ts:62

Returns ​

Buffer<ArrayBufferLike>[]

Implementation of ​

IClientChannel.stopBuffering

Built with VitePress