Pipecat C++ Client SDK 1.0.0
Connect native apps to Pipecat bots
Loading...
Searching...
No Matches
pipecat::DailyTransport Class Reference

#include <pipecat/daily/transport.h>

Inheritance diagram for pipecat::DailyTransport:
pipecat::Transport

Public Member Functions

 DailyTransport (DailyTransportOptions options={})
 Creates a transport.
 
 ~DailyTransport () override
 Disconnects if needed.
 
 DailyTransport (const DailyTransport &)=delete
 Transports can't be copied.
 
DailyTransport & operator= (const DailyTransport &)=delete
 Transports can't be copied.
 
void initialize (TransportObserver *observer) override
 Prepares Daily.
 
void connect (const nlohmann::json &params) override
 
void disconnect () override
 Leaves the room.
 
void send_ready_message (const rtvi::Message &message) override
 Sends the client-ready message once the bot's audio is playing.
 
void send_message (const rtvi::Message &message) override
 Sends a message to the bot.
 
int32_t send_user_audio (const int16_t *frames, size_t num_frames) override
 
int32_t read_bot_audio (int16_t *frames, size_t num_frames) override
 
- Public Member Functions inherited from pipecat::Transport
virtual size_t max_message_size () const
 The largest message, in bytes, that send_message() accepts.
 

Detailed Description

Connects to Pipecat bots over Daily (WebRTC).

Give it to PipecatClientOptions::transport. To connect, it needs the URL of the bot's Daily room, and a token if the room needs one. Start endpoints like Pipecat Cloud return both, as dailyRoom and dailyToken.

You can use several at the same time, e.g. one per client to talk to several bots.

Member Function Documentation

◆ connect()

void pipecat::DailyTransport::connect ( const nlohmann::json &  params)
overridevirtual

Joins the bot's Daily room.

params has the room URL in url (or dailyRoom or room_url), and the token, if the room needs one, in token (or dailyToken). Throws InvalidTransportParamsError if there's no URL, and TransportStartError if joining fails.

Implements pipecat::Transport.

◆ disconnect()

void pipecat::DailyTransport::disconnect ( )
overridevirtual

Leaves the room.

Implements pipecat::Transport.

◆ initialize()

void pipecat::DailyTransport::initialize ( TransportObserver *  observer)
overridevirtual

Prepares Daily.

Implements pipecat::Transport.

◆ read_bot_audio()

int32_t pipecat::DailyTransport::read_bot_audio ( int16_t *  frames,
size_t  num_frames 
)
overridevirtual

Reads up to num_frames frames of 16-bit PCM bot audio, in the format of the options. Waits until there's audio to read, or until the transport disconnects. Returns the number of frames read, or 0 if it disconnected.

Implements pipecat::Transport.

◆ send_message()

void pipecat::DailyTransport::send_message ( const rtvi::Message &  message)
overridevirtual

Sends a message to the bot.

Implements pipecat::Transport.

◆ send_ready_message()

void pipecat::DailyTransport::send_ready_message ( const rtvi::Message &  message)
overridevirtual

Sends the client-ready message once the bot's audio is playing.

Implements pipecat::Transport.

◆ send_user_audio()

int32_t pipecat::DailyTransport::send_user_audio ( const int16_t *  frames,
size_t  num_frames 
)
overridevirtual

Sends num_frames frames of 16-bit PCM user audio, in the format of the options. Returns the number of frames sent.

Send the audio continuously, as it's captured, and send silence while the user is muted: the bot needs it to tell when the user stops speaking. The audio is sent as is, without echo cancellation.

Implements pipecat::Transport.


The documentation for this class was generated from the following file: