|
Pipecat C++ Client SDK 1.0.0
Connect native apps to Pipecat bots
|
The Daily transport, DailyTransport, connects the client to Pipecat bots over Daily, using WebRTC. To build it, see its README.
Give a DailyTransport to the client when you create it:
Then use the client as usual. Everything else, like callbacks and threads, works the same with every transport.
The transport joins the bot's Daily room. It needs the room URL, and a token if the room needs one.
Start endpoints, like Pipecat Cloud or Pipecat's development runner, can create the room when they start the bot. Ask for one with createDailyRoom, and the client passes the room they answer with to the transport:
If your app already has the room, e.g. because your backend started the bot, connect to it directly:
The room URL can be in url, dailyRoom or room_url, and the token in token or dailyToken.
The transport sends the user's audio to the bot and receives the bot's, as 16-bit PCM. Choose the sample rate and channels with DailyTransportOptions. They default to 16 kHz mono:
Send and read audio with the client's send_user_audio() and read_bot_audio(), from your audio threads. read_bot_audio() waits until there's bot audio to read. Disconnecting wakes it up, so disconnect before stopping a thread that reads bot audio.
Send the user's 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 user's audio is sent as is, without echo cancellation. If your app plays the bot through speakers, use your platform's echo cancellation or headphones, or the bot will hear itself.
Each client needs its own DailyTransport, and you can have several clients at the same time, e.g. to talk to several bots. A client can also disconnect and connect again as many times as you need.