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

#include <pipecat/transport.h>

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

Public Member Functions

virtual void initialize (TransportObserver *observer)=0
 
virtual void connect (const nlohmann::json &params)=0
 
virtual void disconnect ()=0
 
virtual void send_ready_message (const rtvi::Message &message)=0
 
virtual void send_message (const rtvi::Message &message)=0
 Sends a message to the bot. Returns right away.
 
virtual size_t max_message_size () const
 The largest message, in bytes, that send_message() accepts.
 
virtual int32_t send_user_audio (const int16_t *frames, size_t num_frames)=0
 
virtual int32_t read_bot_audio (int16_t *frames, size_t num_frames)=0
 

Detailed Description

Connects the client to a bot, e.g. over WebRTC.

Implement this to add a new transport. Only PipecatClient calls these methods, and never from inside a TransportObserver method, so connect() and disconnect() can wait for the transport's own events. It calls initialize(), connect() and disconnect() one at a time.

Member Function Documentation

◆ connect()

virtual void pipecat::Transport::connect ( const nlohmann::json &  params)
pure virtual

Connects to the bot and returns once connected.

params are the transport's connection parameters, usually what PipecatClient::start_bot() returned. Throws InvalidTransportParamsError if they're wrong, and TransportStartError if connecting fails.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.

◆ disconnect()

virtual void pipecat::Transport::disconnect ( )
pure virtual

Disconnects from the bot and returns once disconnected. Does nothing if not connected.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.

◆ initialize()

virtual void pipecat::Transport::initialize ( TransportObserver *  observer)
pure virtual

Prepares the transport. Called once, before anything else, with the observer to send events to.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.

◆ max_message_size()

virtual size_t pipecat::Transport::max_message_size ( ) const
inlinevirtual

The largest message, in bytes, that send_message() accepts.

Reimplemented in pipecat::WebSocketTransport.

◆ read_bot_audio()

virtual int32_t pipecat::Transport::read_bot_audio ( int16_t *  frames,
size_t  num_frames 
)
pure virtual

Reads up to num_frames frames of 16-bit PCM bot audio into frames. Returns the number of frames read.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.

◆ send_message()

virtual void pipecat::Transport::send_message ( const rtvi::Message &  message)
pure virtual

Sends a message to the bot. Returns right away.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.

◆ send_ready_message()

virtual void pipecat::Transport::send_ready_message ( const rtvi::Message &  message)
pure virtual

Sends the client-ready message.

Send it as soon as the bot can receive it, which may be after connect() returns (e.g. once the bot's audio starts). You can add details about the transport to the message.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.

◆ send_user_audio()

virtual int32_t pipecat::Transport::send_user_audio ( const int16_t *  frames,
size_t  num_frames 
)
pure virtual

Sends num_frames frames of 16-bit PCM user audio to the bot. Returns the number of frames sent.

Implemented in pipecat::DailyTransport, and pipecat::WebSocketTransport.


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