Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

datachannel-wasm

> DevOps
Open source

C++ WebRTC Data Channels and WebSockets for WebAssembly in browsers

197 stars0 likes3 views
WebsiteGitHub

About

C++ WebRTC Data Channels and WebSockets for WebAssembly in browsers

datachannel-wasm - C++ WebRTC Data Channels for WebAssembly in browsers

datachannel-wasm is a C++ WebRTC Data Channels and WebSocket wrapper for Emscripten compatible with libdatachannel.

datachannel-wasm exposes the same API as libdatachannel, and therefore allows to compile the same C++ code using Data Channels and WebSockets to WebAssembly for browsers in addition to native targets supported by libdatachannel. The interface is only a subset of the one of libdatachannel, in particular, tracks and media transport are not supported. See what is available in wasm/include.

These wrappers were originally written for my multiplayer game Convergence and were extracted from there to be easily reusable.

datachannel-wasm is licensed under MIT, see LICENSE.

Installation

You just need to add datachannel-wasm as a submodule in your Emscripten project:

bash
$ git submodule add https://github.com/paullouisageneau/datachannel-wasm.git deps/datachannel-wasm
$ git submodule update --init --recursive

CMakeLists.txt:

cmake
[...]
add_subdirectory(deps/datachannel-wasm EXCLUDE_FROM_ALL)
target_link_libraries(YOUR_TARGET datachannel-wasm)

Since datachannel-wasm is compatible with libdatachannel, you can easily leverage both to make the same C++ code compile to native (including Apple macOS and Microsoft Windows):

bash
$ git submodule add https://github.com/paullouisageneau/datachannel-wasm.git deps/datachannel-wasm
$ git submodule add https://github.com/paullouisageneau/libdatachannel.git deps/libdatachannel
$ git submodule update --init --recursive --depth 1

CMakeLists.txt:

cmake
if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
    add_subdirectory(deps/datachannel-wasm EXCLUDE_FROM_ALL)
    target_link_libraries(YOUR_TARGET datachannel-wasm)
else()
    option(NO_MEDIA "Disable media support in libdatachannel" ON)
    add_subdirectory(deps/libdatachannel EXCLUDE_FROM_ALL)
    target_link_libraries(YOUR_TARGET datachannel)
endif()

Building

Building requires that you have emsdk installed and activated in your environment:

bash
$ cmake -B build -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
$ cd build
$ make -j2

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++cppdatachannelemscriptenlibdatachannel

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理