icebreaker.io enables peer-to-peer real-time communications, using WebRTC technology. It is built on top of socket.io, and it basically allows two peers to resolve how to connect over the internet and start an RTCPeerConnection. It consists in:
- a Node.js signaling server (this repository)
- a Javascript client library for the browser
WebRTC enables peer-to-peer communications, but the signaling methods and protocols needed for peers to discover each other are not defined by it. The reasoning behind this is summarized in the JavaScript Session Establishment Protocol (JSEP) IETF draft. This is why a signaling server is needed, so peers can discover and exchange information prior to establishing the WebRTC connection, but also after that, like:
- ICE candidates information.
- Session Description metadata (media details, transport addresses, etc).
- Errors.
- Remote peer disconnection.
- Etc.
npm install icebreaker.io --save
icebreaker.io uses the same interface as socket.io, since it is built on top of it. As an example, below you can find how to start icebreaker.io along with Express:
const express = require('express');
const https = require('https');
const credentials = require('../your-credentials'); // credentials are needed for HTTPS
const icebreaker = require('icebreaker.io');
const app = express();
const server = https.createServer(credentials, app);
server.listen(8443);
// start signaling server
icebreaker(server);
You can find a fully working demo project that uses both server and client icebreaker.io libraries here. It is a very basic video-chat application.
npm run test
This command runs the gulp
task test
, which runs the unit tests in the tests
directory.