rtc-p2p

Proof of concept and demo of using WebRTC data channels to create a browser-based P2P file sharing network.

This project is maintained by rohansingh

rtc-p2p

This is a proof of concept and demo of using WebRTC data channels to create a browser-based P2P file sharing network. The actual implementation is just a proof-of-concept, and not actually optimized for any real world usage.

Browser Compatibility

So far, this has only been tested with Chrome 26. In order to work, the Enable RTCDataChannel flag must be enabled in Chrome on the chrome://flags configuration page.

Limitations

Since this is a proof-of-concept, it has a number of limitations that mean it cannot be used for real life file sharing:

Usage

Install with npm install and start with npm start. The server will start at http://localhost:8000.

Browse to the address above in two or more tabs, and register some files in each tab (preferrably text files).

Copy a file hash from one tab into another tab's Request File box and request the file. The first 100 bytes of the request file should be transferred.

Node? I thought this was P2P?

Files are transferred directly between peers, but a server is needed for two things:

  1. WebRTC requires a server or some sort of intermediary to exchange signaling and session data. This must be done before a connection between two peers can be established.

    In this case, each peer communicates with the server using WebSockets to exchange signaling data with other peers.

  2. rtc-p2p uses a web worker to compute the SHA1 hashes of registered files in the background. Web workers run on the client, but must be served from a server.

Further Reading

Slides from my presentation on this project at sthlm.js are available at: http://www.rvl.io/rohansingh/p2p