Pipecat C++ Client SDK 1.0.0
Connect native apps to Pipecat bots
Loading...
Searching...
No Matches
transport.h
Go to the documentation of this file.
1//
2// Copyright (c) 2024-2026, Daily
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6
9
10#ifndef PIPECAT_WEBSOCKET_TRANSPORT_H
11#define PIPECAT_WEBSOCKET_TRANSPORT_H
12
13#include <pipecat/transport.h>
14
15#include <nlohmann/json.hpp>
16
17#include <cstddef>
18#include <cstdint>
19#include <memory>
20
21namespace pipecat {
22
26 uint32_t user_audio_sample_rate = 16000;
30 uint32_t bot_audio_sample_rate = 16000;
32 uint8_t bot_audio_channels = 1;
33};
34
45 public:
48
51
54
57
59 void initialize(TransportObserver* observer) override;
60
67 void connect(const nlohmann::json& params) override;
68
70 void disconnect() override;
71
73 void send_ready_message(const rtvi::Message& message) override;
74
76 void send_message(const rtvi::Message& message) override;
77
79 size_t max_message_size() const override;
80
87 int32_t send_user_audio(const int16_t* frames, size_t num_frames) override;
88
97 int32_t read_bot_audio(int16_t* frames, size_t num_frames) override;
98
99 private:
100 class Impl;
101 std::unique_ptr<Impl> _impl;
102};
103
104} // namespace pipecat
105
106#endif
Definition transport.h:54
Definition transport.h:88
Definition transport.h:44
int32_t send_user_audio(const int16_t *frames, size_t num_frames) override
void send_ready_message(const rtvi::Message &message) override
Sends the client-ready message.
void connect(const nlohmann::json &params) override
WebSocketTransport & operator=(const WebSocketTransport &)=delete
Transports can't be copied.
WebSocketTransport(const WebSocketTransport &)=delete
Transports can't be copied.
int32_t read_bot_audio(int16_t *frames, size_t num_frames) override
void disconnect() override
Closes the WebSocket.
void initialize(TransportObserver *observer) override
Prepares the transport.
void send_message(const rtvi::Message &message) override
Sends a message to the bot.
~WebSocketTransport() override
Disconnects if needed.
WebSocketTransport(WebSocketTransportOptions options={})
Creates a transport.
size_t max_message_size() const override
The largest message the bot accepts, about 1 MB.
The Pipecat C++ client SDK.
Definition client.h:29
Options to create a WebSocketTransport.
Definition transport.h:24
uint32_t user_audio_sample_rate
Sample rate of the user audio you send, in Hz.
Definition transport.h:26
uint8_t bot_audio_channels
Number of channels of the bot audio you read.
Definition transport.h:32
uint8_t user_audio_channels
Number of channels of the user audio you send.
Definition transport.h:28
uint32_t bot_audio_sample_rate
Sample rate of the bot audio you read, in Hz.
Definition transport.h:30
Definition messages.h:280