百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

datachannel-wasm

> DevOps
开源

浏览器中 WebAssembly 的 C++ WebRTC 数据通道和 WebSocket

197 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

浏览器中 WebAssembly 的 C++ WebRTC 数据通道和 WebSocket

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++cppdatachannelemscriptenlibdatachannel

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

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