node package manager is inspired by the amazing framework and implements a real-time communication using the WebRTC technology. Peers are directly connected and datas are exchanged between clients without passing throug the server. has two purposes:

  • Serve signals between clients needed to coordinate the communication.
  • In case peer-to-peer communication fails or your browser does not support WebRTC, serve also the data message.


npm install

On the Server

var server = require('http').createServer();
var dc = require('').listen(server, options);


Redis Store

If you want to implement sessions management or horizontal scaling you need a redis server.

Note: By default, redis-server binds to local only. Edit redis.conf to comment out this option or you will receive an ECONNECTREFUSED error. The line to comment out is: bind

var server = require('http').createServer();
var dc = require('').listen(server, {
	redis: {port: [INTEGER], host: [STRING], options: { pass: [STRING] }},


Static File

If you do not want to serve the static client file at / you need to add the parameter static: false.

var server = require('http').createServer();
var dc = require('').listen(server, {
	static: false


Add a Namespace

You need to add at least one namespace:

dc.addNameSpace([STRING], {
	session: {
		cookie: {name: [STRING], secret: [STRING]},
		auth: function(session) {
			return true;

Session management is optional, if you want to use it you need a Redis server configured. The session object has this parameters:

  • cookie [mandatory]: object with name of the cookie and secret key
  • auth [optional, default as return true]: function that return the authorization to use the server based on the current session.

On the Client


<!DOCTYPE html>
		<script src="http://<yourHost>/"></script>
			var datachannel = new DataChannel({
				socketServer: 'http://<yourHost>'


The parameters of the new DataChannel(object) are:

  • socketServer [mandatory]: the address of the socket server used to serve signals between clients
  • nameSpace [optional, default as 'dataChannel']: namespace of the server
  • rtcServers [optional, default as null]: RTC Servers

Join a Room


Leave a Room


Send a Message"room").emit("chat", {text: 'Hi!'});

Get a Message"room").on("chat", function(data) {


  • SSL

Tested on Chrome v25 and Firefox v20.

Some examples at

More information at