node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



tl;dr ring inspired ring DHT algorithm using WebRTC as transport layer for P2P in the browser. It enables you to communicate between several browsers in a p2p/decentralized fashion though a DHT.

DISCLAIMER Since the creation of this module, I've learned some very important behavior patterns about WebRTC datachannels while attempting to distribute raytracing jobs (simple example of parellism computing) over several browsers, you can find more it here: . I'll no longer support this module in favor of a more powerful and simple one, named webrtc-explorer



![Gitter]( Chat.svg) Dependency Status

How to create a node

webrtc-ring uses browserify

var ring = require('webrtc-ring');
var nodeConfig = {
  signalingURL: ''
var node = ring.createNode(nodeConfig);
node.e.on('ready', function () {
  // this node is ready

How to communicate with other nodes

Send a message to a Node responsible for the ID 1af17e73721dbe0c40011b82ed4bb1a7dbe3ce29

var toId = '1af17e73721dbe0c40011b82ed4bb1a7dbe3ce29'; 
// 160 bit ID represented in hex(`git_sha1` module is a good way to generate these)
node.send(destID: toId, 
          data: 'hey, how are you doing');

Send a message to this node sucessor (next node in ring)

node.sendSucessor(data: 'hey, how are you doing');

Receive a message

node.e.on('message', function(message) {

Other options


add the logging flag to your nodeConfig

var nodeConfig = {
  logging: true