1414Use this SDK to add realtime video, audio and data features to your C++ app. By connecting to <a href =" https://livekit.io/ " >LiveKit</a > Cloud or a self-hosted server, you can quickly build applications such as multi-modal AI, live streaming, or video calls with just a few lines of code.
1515<!-- END_DESCRIPTION-->
1616
17- ## Build & Installation Guide
18-
19- This page covers how to build and install the LiveKit C++ Client SDK for real-time audio/video communication.
20-
21- ---
22-
23- ### 📦 Requirements
17+ ## 📦 Requirements
2418- ** CMake** ≥ 3.20
2519- ** Rust / Cargo** (latest stable toolchain)
2620- ** Git LFS** (required for examples)
@@ -31,19 +25,19 @@ This page covers how to build and install the LiveKit C++ Client SDK for real-ti
3125
3226** Platform-Specific Requirements:**
3327
34- #### For Building the SDK:
28+ ### For Building the SDK:
3529- ** Windows:** Visual Studio 2019+, vcpkg
3630- ** Linux:** ` sudo apt install libprotobuf-dev libssl-dev ` (protobuf 3.x)
3731- ** macOS:** ` brew install protobuf ` (protobuf 3.x)
3832
39- #### For Using the Pre-built SDK:
33+ ### For Using the Pre-built SDK:
4034- ** Windows:** ✅ All dependencies included (DLLs bundled) - ready to use
4135- ** Linux:** ⚠️ Requires ` libprotobuf ` and ` libssl-dev ` ; deploy ` liblivekit_ffi.so ` with your executable
4236- ** macOS:** ⚠️ Requires ` protobuf ` ; deploy ` liblivekit_ffi.dylib ` with your executable
4337
4438> ** Note** : If the SDK was built with Protobuf 6.0+, you also need ` libabsl-dev ` (Linux) or ` abseil ` (macOS).
4539
46- ### 🧩 Clone the Repository
40+ ## 🧩 Clone the Repository
4741
4842Make sure to initialize the Rust submodule (` client-sdk-rust ` ):
4943
@@ -57,9 +51,9 @@ cd client-sdk-cpp
5751git submodule update --init --recursive
5852```
5953
60- ### ⚙️ BUILD
54+ ## ⚙️ BUILD
6155
62- #### Quick Build (Using Build Scripts)
56+ ### Quick Build (Using Build Scripts)
6357
6458** Linux/macOS:**
6559``` bash
@@ -71,6 +65,17 @@ git submodule update --init --recursive
7165./build.sh release-tests # Build Release with tests
7266```
7367** Windows**
68+ Using build scripts:
69+ ``` powershell
70+ .\build.cmd clean # Clean CMake build artifacts
71+ .\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
72+ .\build.cmd debug # Build Debug version
73+ .\build.cmd release # Build Release version
74+ .\build.cmd debug-tests # Build Debug with tests
75+ .\build.cmd release-tests # Build Release with tests
76+ ```
77+
78+ ### Windows build using cmake/vcpkg
7479``` bash
7580cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=" $PWD /vcpkg/scripts/buildsystems/vcpkg.cmake" # Generate Makefiles in build folder
7681# Build (Release or Debug)
@@ -86,17 +91,7 @@ You must install protobuf via vcpkg (so CMake can find ProtobufConfig.cmake and
8691.\v cpkg\v cpkg install protobuf:x64-windows
8792```
8893
89- ** Windows:**
90- ``` powershell
91- .\build.cmd clean # Clean CMake build artifacts
92- .\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
93- .\build.cmd debug # Build Debug version
94- .\build.cmd release # Build Release version
95- .\build.cmd debug-tests # Build Debug with tests
96- .\build.cmd release-tests # Build Release with tests
97- ```
98-
99- #### Advanced Build (Using CMake Presets)
94+ ### Advanced Build (Using CMake Presets)
10095
10196For more control and platform-specific builds, see the detailed instructions in [ README_BUILD.md] ( README_BUILD.md ) .
10297
@@ -128,15 +123,23 @@ cmake --build --preset macos-release
128123
129124📖 ** For complete build instructions, troubleshooting, and platform-specific notes, see [ README_BUILD.md] ( README_BUILD.md ) **
130125
131- ### 🧪 Run Example
126+ ### Building with Docker
127+ The Dockerfile COPYs folders/files required to build the CPP SDK into the image.
128+ ** NOTE:** this has only been tested on Linux
129+ ``` bash
130+ docker build -t livekit-cpp-sdk . -f docker/Dockerfile
131+ docker run -it --network host livekit-cpp-sdk:latest bash
132+ ```
133+
134+ ## 🧪 Run Example
132135
133136### Generate Tokens
134137Before running any participant, create JWT tokens with the proper identity and room name, example
135138``` bash
136139lk token create -r test -i your_own_identity --join --valid-for 99999h --dev --room=your_own_room
137140```
138141
139- #### SimpleRoom
142+ ### SimpleRoom
140143
141144``` bash
142145./build/examples/SimpleRoom --url $URL --token < jwt-token>
@@ -164,23 +167,23 @@ If the E2EE keys do not match between participants:
164167
165168Press Ctrl-C to exit the example.
166169
167- #### SimpleRpc
170+ ### SimpleRpc
168171The SimpleRpc example demonstrates how to:
169172- Connect multiple participants to the same LiveKit room
170173- Register RPC handlers (e.g., arrival, square-root, divide, long-calculation)
171174- Send RPC requests from one participant to another
172175- Handle success, application errors, unsupported methods, and timeouts
173176- Observe round-trip times (RTT) for each RPC call
174177
175- ##### 🔑 Generate Tokens
178+ #### 🔑 Generate Tokens
176179Before running any participant, create JWT tokens with ** caller** , ** greeter** and ** math-genius** identities and room name.
177180``` bash
178181lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
179182lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
180183lk token create -r test -i math-genius --join --valid-for 99999h --dev --room=your_own_room
181184```
182185
183- ##### ▶ Start Participants
186+ #### ▶ Start Participants
184187Every participant is run as a separate terminal process, note --role needs to match the token identity.
185188``` bash
186189./build/examples/SimpleRpc --url $URL --token < jwt-token> --role=math-genius
@@ -191,7 +194,7 @@ The caller will automatically:
191194- Print round-trip times
192195- Annotate expected successes or expected failures
193196
194- #### SimpleDataStream
197+ ### SimpleDataStream
195198- The SimpleDataStream example demonstrates how to:
196199- Connect multiple participants to the same LiveKit room
197200- Register text stream and byte stream handlers by topic (e.g. "chat", "files")
@@ -201,14 +204,14 @@ The caller will automatically:
201204- Measure and print one-way latency on the receiver using sender timestamps
202205- Receive streamed chunks and reconstruct the full payload on the receiver
203206
204- ##### 🔑 Generate Tokens
207+ #### 🔑 Generate Tokens
205208Before running any participant, create JWT tokens with caller and greeter identities and your room name.
206209``` bash
207210lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
208211lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
209212```
210213
211- ##### ▶ Start Participants
214+ #### ▶ Start Participants
212215Start the receiver first (so it registers stream handlers before messages arrive):
213216``` bash
214217./build/examples/SimpleDataStream --url $URL --token < jwt-token>
@@ -312,7 +315,7 @@ and a **ROS2 bridge** that maps `LogLevel` to `RCLCPP_*` macros.
312315
313316---
314317
315- ### 🧪 Integration & Stress Tests
318+ ## 🧪 Integration & Stress Tests
316319
317320The SDK includes integration and stress tests using Google Test (gtest).
318321
@@ -330,7 +333,7 @@ The SDK includes integration and stress tests using Google Test (gtest).
330333.\build.cmd release-tests
331334```
332335
333- #### Run Tests
336+ ### Run Tests
334337
335338After building, run tests using ctest or directly:
336339
@@ -348,7 +351,7 @@ ctest --output-on-failure
348351./build-debug/bin/livekit_stress_tests --gtest_filter=" *MaxPayloadStress*"
349352```
350353
351- #### Test Types
354+ ### Test Types
352355
353356| Executable | Description |
354357| ------------| -------------|
@@ -376,29 +379,29 @@ lk token create -r test -i rpc-caller --join --valid-for 99999h --dev --room=rpc
376379lk token create -r test -i rpc-receiver --join --valid-for 99999h --dev --room=rpc-test-room
377380```
378381
379- #### Test Coverage
382+ ### Test Coverage
380383
381384- ** SDK Initialization** : Initialize/shutdown lifecycle
382385- ** Room** : Room creation, options, connection
383386- ** Audio Frame** : Frame creation, manipulation, edge cases
384387- ** RPC** : Round-trip calls, max payload (15KB), timeouts, errors, concurrent calls
385388- ** Stress Tests** : High throughput, bidirectional RPC, memory pressure
386389
387- ### 🧰 Recommended Setup
388- #### macOS
390+ ## 🧰 Recommended Setup
391+ ### macOS
389392``` bash
390393brew install cmake protobuf rust
391394```
392395
393- #### Ubuntu / Debian
396+ ### Ubuntu / Debian
394397``` bash
395398sudo apt update
396399sudo apt install -y cmake protobuf-compiler build-essential
397400curl https://sh.rustup.rs -sSf | sh
398401```
399402
400- ### 🛠️ Development Tips
401- #### Update Rust version
403+ ## 🛠️ Development Tips
404+ ### Update Rust version
402405``` bash
403406cd client-sdk-cpp
404407git fetch origin
@@ -417,19 +420,19 @@ git -C client-sdk-rust/yuv-sys submodule update --init --recursive --checkout
417420git submodule status --recursive
418421```
419422
420- #### If yuv-sys fails to build
423+ ### If yuv-sys fails to build
421424``` bash
422425cargo clean -p yuv-sys
423426cargo build -p yuv-sys -vv
424427```
425428
426- #### Full clean (Rust + C++ build folders)
429+ ### Full clean (Rust + C++ build folders)
427430In some cases, you may need to perform a full clean that deletes all build artifacts from both the Rust and C++ folders:
428431``` bash
429432./build.sh clean-all
430433```
431434
432- #### Clang format
435+ ### Clang format
433436CPP SDK is using clang C++ format
434437``` bash
435438brew install clang-format
0 commit comments