0.0.1 • Published 5 years ago

wrtc2 v0.0.1

Weekly downloads
7
License
BSD-2-Clause
Repository
github
Last release
5 years ago

NPM

OS X/Linus Build Status Windows Build status

Preamble

This open-source project provides a native module for NodeJS that supports a subset of standards-compliant WebRTC features. Specifically, the PeerConnection and DataChannel APIs.

MediaStream APIs are not supported.

This project relies on precompiled WebRTC binaries provided by libwebrtc.

Contributing

The best way to get started is to read through the Getting Started and Example sections before having a look through the open issues. Some of the issues are marked as good first bug, but feel free to contribute to any of the issues there, or open a new one if the thing you want to work on isn't there yet.

Once you've done some hacking and you'd like to have your work merged, you'll need to make a pull request. If your patch includes code, make sure to check that all the unit tests pass, including any new tests you wrote. Finally, make sure you add yourself to the AUTHORS file.

Whenever possible, prefer making pull requests to opening issues.

Getting Started

Prerequisites

This library will attempt to download pre-compiled binaries for your particular platform using node-pre-gyp; however, if binaries are unavailable, it will fallback to building from source. In this case, the prerequisites for building from source are the same as node-cmake. Refer to node-cmake for the particular prerequisites for your platform.

Install

The easiest way to install is via npm:

npm install wrtc

If you want to work from source:

git clone https://github.com/js-platform/node-webrtc.git
cd node-webrtc
npm install

Tests

Unit tests

Once everything is built, try npm test as a sanity check.

bridge.js

You can run the data channel demo by node examples/bridge.js and browsing to localhost:8080/peer.html.

Usage:

node examples/bridge.js [-h <host>] [-p <port>] [-ws <ws port>]

Options:

-h  host IP for the webserver that will serve the static files (default 127.0.0.1)
-p  host port for the webserver that will serve the static files (default 8080)
-ws port of the Web Socket server (default 8080)

If the bridge and peer are on different machines, you can pass the bridge address to the peer by:

http://<webserver>/peer.html?<sockertserver:port>

By default the bridge will be the same IP as the webserver and will listen on port 8080.

ping-pong-test.js

The ping-pong example creates two peer connections and sends some data between them.

Usage:

node examples/ping-pong-test.js