https://github.com/mertushka/webrtc-node
WebRTC data channels for Node.js, backed by libdatachannel and validated with 620 selected Web Platform Tests subtests
https://github.com/mertushka/webrtc-node
libdatachannel node-api nodejs rtcdatachannel rtcpeerconnection webrtc wpt
Last synced: about 1 month ago
JSON representation
WebRTC data channels for Node.js, backed by libdatachannel and validated with 620 selected Web Platform Tests subtests
- Host: GitHub
- URL: https://github.com/mertushka/webrtc-node
- Owner: mertushka
- License: mpl-2.0
- Created: 2026-05-28T18:15:03.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-14T00:52:42.000Z (about 1 month ago)
- Last Synced: 2026-06-14T02:23:16.374Z (about 1 month ago)
- Topics: libdatachannel, node-api, nodejs, rtcdatachannel, rtcpeerconnection, webrtc, wpt
- Language: JavaScript
- Homepage:
- Size: 381 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
webrtc-node
WebRTC data channels for Node.js, backed by
libdatachannel
and validated with 620 selected Web Platform Tests subtests.
```sh
npm install @mertushka/webrtc-node
```
## Usage
```js
const { RTCPeerConnection } = require("@mertushka/webrtc-node");
const pc = new RTCPeerConnection({ iceServers: [] });
const channel = pc.createDataChannel("events");
channel.addEventListener("open", () => {
channel.send("hello from Node");
});
channel.addEventListener("message", (event) => {
console.log(event.data);
});
```
See [examples/datachannel.js](examples/datachannel.js) for a complete local
offer/answer exchange.
## Supported Platforms
Node.js 20 or newer is required. The npm package downloads a matching Node-API
prebuild when available, verifies its SHA-256 digest and target, then falls back
to a `cmake-js` source build.
| OS | Prebuild targets | Node 20 | Node 22 | Node 24 |
| --- | --- | --- | --- | --- |
| Linux | x64 glibc, x64 musl | ✅ | ✅ | ✅ |
| macOS | x64, arm64 | ✅ | ✅ | ✅ |
| Windows | x64, arm64 | ✅ | ✅ | ✅ |
Source builds require CMake, a C++17 compiler, and OpenSSL development
libraries.
## Performance Snapshot
Local benchmark snapshots show this package ahead on binary throughput and
object operation rates. Benchmarks are environment-sensitive; treat them as
directional rather than a substitute for testing your workload.
| Metric | `webrtc-node` | `node-datachannel` | `@roamhq/wrtc` |
| --- | ---: | ---: | ---: |
| Linux binary 8 KiB x1000 | 39.9 MB/s | 30.4 MB/s | 27.4 MB/s |
| Linux construct+close PC | 53k ops/s | 3.2k ops/s | 200 ops/s |
| Linux negotiated DC create+close | 2.2k ops/s | 974 ops/s | 173 ops/s |
## Contributing
Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request. Public
API changes should update runtime code, TypeScript declarations, tests, and WPT
documentation together.
## License
Mozilla Public License 2.0. See [LICENSE](LICENSE).