Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including webrtc-explorer with all npm packages installed. Try it out:

var webrtcExplorer = require("webrtc-explorer")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

webrtc-explorer v1.1.1

Chord inspired ring DHT algorithm using WebRTC as transport layer for P2P in the browser


tl;dr webrtc-explorer is a Chord inspired P2P overlay network designed for the Web platform (browsers), using WebRTC as its transport between peers and WebSockets for Signaling data. Essentially, it enables your peers (browsers) to communicate between each other without the need to have a server as a mediator of messages.

Project Information

David Dias MSc in Peer-to-Peer Networks by Technical University of Lisbon

This work was developed by David Dias with supervision by Luís Veiga, all in INESC-ID Lisboa (Distributed Systems Group), Instituto Superior Técnico, Universidade de Lisboa, with the support of Fundação para a Ciência e Tecnologia.

More info on the team's work at:


If you use this project, please acknowledge it in your work by referencing the following document:

David Dias and Luís Veiga. browserCloud.js A federated community cloud served by a P2P overlay network on top of the web platform. INESC-ID Tec. Rep. 14/2015, Apr. 2015



![Gitter]( Chat.svg) Dependency Status


  • Ids have 48 bits (so that is a multiple of 4 (for hex notation) and doesn't require importing a big-num lib to handle over 53 bits operations)
  • The number of fingers of each peer is flexible, however it is recommended to not pass 16 per node (due to browser resource constraints)
  • Each peer is responsible for a segment of the hash ring
  • The signaling server for webrtc-explorer can be found at:


webrtc-explorer uses browserify

Create a new peer

var Explorer = require('webrtc-explorer');

var config = {
    signalingURL: ''
var peer = new Explorer(config);'ready', function () {
    // this node is ready

Register the peer'registered', function(data){
    // peer registered with data.peerId


Send and receive a message

peerIds are 48 bits represented in a string using hex format. To send, in one peer:

var data = 'hey peer, how is it going';

peer.send('abcd0f0fdbca', data);

To receive, in another peer (responsible for that Id)'message', function(envelope){
    // message from the other peer

Other options


add the logging flag to your config

var config = {
    logging: true

How does it work

To understand fully webrtc-explorer's core, it is crucial to be familiar with the Chord. webrtc-explorer levarages important battle experience from building webrtc-ring -

  • I'll upload my notes and images soon, I'm trying to make them as legible as possible. If you have a urgency in one of the parts, please let me know, so that I put that one as a priority.

Registering a peer

Updating the finger table

Signaling between two peers

Message routing


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free