node-webrtc is a Node.js Native Addon that provides bindings to WebRTC M98. This project is aiming for spec-compliance and will eventually be tested using the W3C's web-platform-tests project. A number of nonstandard APIs for testing are also included.
npm install @qawolf/wrtc
Installing from NPM downloads a prebuilt binary for your operating system × architecture, based on optional dependency filters.
To install a debug build or cross-compile, you should build from source.
The following platforms are confirmed to work with node-webrtc and have prebuilt binaries available. Since node-webrtc targets N-API version 3, there may be additional platforms supported that are not listed here. If your platform is not supported, you may still be able to build from source.
| Linux | macOS | Windows | ||||
|---|---|---|---|---|---|---|
| x64 | arm64 | x64 | arm64 | x64 | ||
| Node | 20 | ✓ | ? | ✓ | ✓ | ✓ |
| 22 | ✓ | ? | ✓ | ✓ | ✓ | |
See node-webrtc/node-webrtc-examples.
This fork (@qawolf/wrtc) includes custom scripts to facilitate building for Linux (via Docker) and macOS.
Ensure you are authenticated with the GitHub Package Registry. Your ~/.npmrc should be configured with your PAT, or you can use the project-level .npmrc provided.
To build the Linux binaries (used in production environments), use the provided Docker scripts. These handle cross-compilation quirks and patch the binaries for portability.
Parallel Build (Recommended): Builds both x64 and arm64 binaries in parallel.
./scripts/build-parallel-docker.shSingle Architecture Build:
You can also build for a specific architecture by setting TARGET_ARCH (defaults to x64).
# Build for x64
./scripts/build-incremental-docker.sh
# Build for arm64
TARGET_ARCH=arm64 ./scripts/build-incremental-docker.shArtifacts will be placed in prebuilds/linux-x64/ and prebuilds/linux-arm64/.
Publishing must be done in a specific order: first the platform-specific binaries, then the main package.
Step A: Publish Platform Binaries
Navigate to each built platform folder in prebuilds/ and publish them.
# Example for Linux x64
cd prebuilds/linux-x64
npm publish
cd ../..
# Example for Linux arm64
cd prebuilds/linux-arm64
npm publish
cd ../..Step B: Publish Main Package
Once the platform binaries are published, publish the root package. It references the others as optionalDependencies.
npm publish