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,32 @@ 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+ __ NOTE:__ if you are building your own Dockerfile, you will likely need to set the same ` ENV ` variables as in ` docker/Dockerfile ` , but to the relevant directories:
135+ ``` bash
136+ export CC=$HOME /gcc-14/bin/gcc
137+ export CXX=$HOME /gcc-14/bin/g++
138+ export LD_LIBRARY_PATH=$HOME /gcc-14/lib64:$LD_LIBRARY_PATH
139+ export PATH=$HOME /.cargo/bin:$PATH
140+ export PATH=$HOME /cmake-3.31/bin:$PATH
141+ ```
142+
143+ ## 🧪 Run Example
132144
133145### Generate Tokens
134146Before running any participant, create JWT tokens with the proper identity and room name, example
135147``` bash
136148lk token create -r test -i your_own_identity --join --valid-for 99999h --dev --room=your_own_room
137149```
138150
139- #### SimpleRoom
151+ ### SimpleRoom
140152
141153``` bash
142154./build/examples/SimpleRoom --url $URL --token < jwt-token>
@@ -164,23 +176,23 @@ If the E2EE keys do not match between participants:
164176
165177Press Ctrl-C to exit the example.
166178
167- #### SimpleRpc
179+ ### SimpleRpc
168180The SimpleRpc example demonstrates how to:
169181- Connect multiple participants to the same LiveKit room
170182- Register RPC handlers (e.g., arrival, square-root, divide, long-calculation)
171183- Send RPC requests from one participant to another
172184- Handle success, application errors, unsupported methods, and timeouts
173185- Observe round-trip times (RTT) for each RPC call
174186
175- ##### 🔑 Generate Tokens
187+ #### 🔑 Generate Tokens
176188Before running any participant, create JWT tokens with ** caller** , ** greeter** and ** math-genius** identities and room name.
177189``` bash
178190lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
179191lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
180192lk token create -r test -i math-genius --join --valid-for 99999h --dev --room=your_own_room
181193```
182194
183- ##### ▶ Start Participants
195+ #### ▶ Start Participants
184196Every participant is run as a separate terminal process, note --role needs to match the token identity.
185197``` bash
186198./build/examples/SimpleRpc --url $URL --token < jwt-token> --role=math-genius
@@ -191,7 +203,7 @@ The caller will automatically:
191203- Print round-trip times
192204- Annotate expected successes or expected failures
193205
194- #### SimpleDataStream
206+ ### SimpleDataStream
195207- The SimpleDataStream example demonstrates how to:
196208- Connect multiple participants to the same LiveKit room
197209- Register text stream and byte stream handlers by topic (e.g. "chat", "files")
@@ -201,14 +213,14 @@ The caller will automatically:
201213- Measure and print one-way latency on the receiver using sender timestamps
202214- Receive streamed chunks and reconstruct the full payload on the receiver
203215
204- ##### 🔑 Generate Tokens
216+ #### 🔑 Generate Tokens
205217Before running any participant, create JWT tokens with caller and greeter identities and your room name.
206218``` bash
207219lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
208220lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
209221```
210222
211- ##### ▶ Start Participants
223+ #### ▶ Start Participants
212224Start the receiver first (so it registers stream handlers before messages arrive):
213225``` bash
214226./build/examples/SimpleDataStream --url $URL --token < jwt-token>
@@ -312,7 +324,7 @@ and a **ROS2 bridge** that maps `LogLevel` to `RCLCPP_*` macros.
312324
313325---
314326
315- ### 🧪 Integration & Stress Tests
327+ ## 🧪 Integration & Stress Tests
316328
317329The SDK includes integration and stress tests using Google Test (gtest).
318330
@@ -330,7 +342,7 @@ The SDK includes integration and stress tests using Google Test (gtest).
330342.\build.cmd release-tests
331343```
332344
333- #### Run Tests
345+ ### Run Tests
334346
335347After building, run tests using ctest or directly:
336348
@@ -348,7 +360,7 @@ ctest --output-on-failure
348360./build-debug/bin/livekit_stress_tests --gtest_filter=" *MaxPayloadStress*"
349361```
350362
351- #### Test Types
363+ ### Test Types
352364
353365| Executable | Description |
354366| ------------| -------------|
@@ -376,29 +388,29 @@ lk token create -r test -i rpc-caller --join --valid-for 99999h --dev --room=rpc
376388lk token create -r test -i rpc-receiver --join --valid-for 99999h --dev --room=rpc-test-room
377389```
378390
379- #### Test Coverage
391+ ### Test Coverage
380392
381393- ** SDK Initialization** : Initialize/shutdown lifecycle
382394- ** Room** : Room creation, options, connection
383395- ** Audio Frame** : Frame creation, manipulation, edge cases
384396- ** RPC** : Round-trip calls, max payload (15KB), timeouts, errors, concurrent calls
385397- ** Stress Tests** : High throughput, bidirectional RPC, memory pressure
386398
387- ### 🧰 Recommended Setup
388- #### macOS
399+ ## 🧰 Recommended Setup
400+ ### macOS
389401``` bash
390402brew install cmake protobuf rust
391403```
392404
393- #### Ubuntu / Debian
405+ ### Ubuntu / Debian
394406``` bash
395407sudo apt update
396408sudo apt install -y cmake protobuf-compiler build-essential
397409curl https://sh.rustup.rs -sSf | sh
398410```
399411
400- ### 🛠️ Development Tips
401- #### Update Rust version
412+ ## 🛠️ Development Tips
413+ ### Update Rust version
402414``` bash
403415cd client-sdk-cpp
404416git fetch origin
@@ -417,19 +429,19 @@ git -C client-sdk-rust/yuv-sys submodule update --init --recursive --checkout
417429git submodule status --recursive
418430```
419431
420- #### If yuv-sys fails to build
432+ ### If yuv-sys fails to build
421433``` bash
422434cargo clean -p yuv-sys
423435cargo build -p yuv-sys -vv
424436```
425437
426- #### Full clean (Rust + C++ build folders)
438+ ### Full clean (Rust + C++ build folders)
427439In some cases, you may need to perform a full clean that deletes all build artifacts from both the Rust and C++ folders:
428440``` bash
429441./build.sh clean-all
430442```
431443
432- #### Clang format
444+ ### Clang format
433445CPP SDK is using clang C++ format
434446``` bash
435447brew install clang-format
0 commit comments