Nodetron

A peer-to-peer, rich-client web app library that uses HTML5 WebRTC and Web Workers to reduce reliance on central servers.

View the Project on GitHub bchu/nodetron

Nodetron

This project is under heavy development. Its API is subject to major, breaking changes.

A peer-to-peer, rich-client web app library that uses HTML5 WebRTC and Web Workers to reduce reliance on central servers and enable greater decentralization by routing requests directly to peers.

Full API Documentation

Notes on Different Approaches

Future Roadmap


Play with the demo app


Overview

Nodetron helps you easily create peer-to-peer applications that do more than just send chats or transfer files. Nodetron consists of a routing and discovery system with which developers can build rich client-side apps that control all user data locally. With Nodetron, all data validation and access permissions are delegated to and handled by the client. Developers are encouraged to then take advantage of IndexedDB, AppCache, and other HTML 5 APIs. In the future, Nodetron will feature tighter integration with those kinds of rich-client APIs.

In more detail:

  1. Clients store all of their own data.
  2. Clients make certain pieces of data public available so that other clients can discover them. This data can be stored by other clients and central servers.
  3. Clients discover other clients by querying a local cache, other clients, or a central server.
    • the current implementation only allows for querying a central server. This will change in the future.
  4. Clients access another client's non-public data by directly sending requests to that other client, with associated metadata.
  5. Clients handle those requests and determine their response. Clients are responsible for authentication of requests. Nodetron will include authentication mechanisms in the future.

Technologies used: WebRTC, socket.io, MongoDB, node-restify.

Getting Started

Note: only recent versions of Chrome and Firefox are currently supported

  1. On the client side: Include the nodetron.js (or nodetron.min.js) scripts manually or use bower install nodetron.
  2. On the server side: npm install nodetron.

Development Instructions

If you get a Error: Cannot find module './build/Debug/DTraceProviderBindings' error, remove restify from your local node_modules folder and re-run npm install in the project root.

More resources:

  1. Workflow instructions at https://github.com/bchu/nodetron/wiki/Workflow

Browser Compatibility

Current Prototype Implementation

Clients send 'discovery queries' to a central server/database. The server responds with potential matches. Clients then contact the matches directly over a WebRTC connection that is brokered by the server. Clients then freely exchange information. Clients specify what information they make publicly available for discovery on the central server. Clients are also responsible for granting or denying access over WebRTC.

Possible Advantages:

Inherent drawbacks:

Acknowledgments:

The client-side WebRTC code includes a forked version of PeerJS (https://github.com/peers/peerjs).

The Nodetron server code is also a heavily modified fork of PeerJS's PeerServer (https://github.com/peers/peerjs-server). Thanks to their great work!

License:

Nodetron is released under the MIT license.