Giter Club home page Giter Club logo

spray-wrtc's Introduction

spray-wrtc Build Status JavaScript Style Guide npm version

Keywords: Random peer-sampling, adaptive, browser-to-browser communication, WebRTC

This project aims to provide a WebRTC implementation of Spray.

Spray [1] is a random peer-sampling protocol [2] inspired by both Cyclon [3] and Scamp [4]. It adapts the partial view of each member to the network size using local knowledge only. Therefore, without any configuration, each peer automatically adjust its functioning to the need of the network.

Publication:

Principle

Peers joining the network inject a logarithmic number of arcs with them. Thus, a 10-peers network has on average 2.3 connections per peer, a 100-peers network has on average 4.6 connections per peer, a 1000 peers network has on average 6.9 connections per peer etc. Consequently, the number of connections scales well in terms of number of peers.

The figure shows that peers are highly clustered. Furthermore, the oldest peers have many outgoing arcs while the newest only has one outgoing arc. To solve this issue, the peers must periodically shuffle their partial view of the network.

Periodically, a peer chooses one of its neighbor to exchange with. Both peers provide half of their partial view comprising neighbors chosen at random. Both peers disconnect from the neighbors they provided and connect to the neighbors they obtained. Periodic shufflings balance the outgoing arcs among the peers. The resulting network has a low clustering coefficient.

Installation

$ npm install spray-wrtc

Find the bundle in bin/spray-wtrtc.bundle.js (debug mode) or in bin/spray-wtrtc.bundle.min.js (production mode)

Miscellaneous

Peersim [5] simulations of Spray are available at peersim-spray.

References

[1] B. Nédelec, J. Tanke, D. Frey, P. Molli, and A. Mostéfaoui. Spray: an Adaptive Random Peer Sampling Protocol. Technical Report, LINA-University of Nantes; INRIA Rennes - Bretagne Atlantique, Sept 2015.

[2] M. Jelasity, S. Voulgaris, R. Guerraoui, A.-M. Kermarrec, and M. Van Steen. Gossip-based peer sampling. ACM Transactions on Computer Systems (TOCS), 25(3):8, 2007.

[3] S. Voulgaris, D. Gavidia, and M. van Steen. Cyclon: Inexpensive membership management for unstructured p2p overlays. Journal of Network and Systems Management, 13(2):197–217, 2005.

[4] A. Ganesh, A.-M. Kermarrec, and L. Massoulié. Peer-to-peer membership management for gossip-based protocols. IEEE Transactions on Computers, 52(2):139–149, Feb 2003.

[5] A. Montresor and M. Jelasity. Peersim: A scalable P2P simulator. Proc. of the 9th Int. Conference on Peer-to-Peer (P2P’09), pages 99–100, Seattle, WA, Sept. 2009.

spray-wrtc's People

Contributors

chat-wane avatar folkvir avatar neokeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spray-wrtc's Issues

Emit spray id during the join event

Hi !
It would be very greatful to emit the id when you emit the join event.

Here is the code to change (line 101/102, spray.js) :

callbacks.onReady = function(id){
  onReadyFunction && onReadyFunction(id);
  // #D emit a join event
  self.emit('join');
};

to

self.emit('join', id);

If you can do it with a NPM release it would be great !

webrtc is more important

Forget about soketio for now. Let's focus on webrtc ;)
Can you rename the project to spray-wrtc ?

On leaving, try to patch the network

Currently, a peer leaving the network does it without giving notice. In that sense, departures are equivalent to crashes. Nevertheless, if enough time is given, it could try to patch the network, i.e., not being as disruptive as it is currently by attempting connections from it inview to its outview (eg A-> B -> C, B leaves but first acts as a bridge to connect A to C, it becomes A -> C )

Empty partial views

Partial views can be temporarily empty during the exchanges in order to not exchange multiple time a same entry.
Nevertheless, it becomes a problem if one wants to broadcast messages in the network...

Forwarding routes without timeout

When an exchange is initiated by Peer Pi with the Peer Pj, it asks to one of its neighbor to give it an offer ticket, then forwards it to Pj and expect Pj to give a stamped ticket in response. However, if Pj already knows the emitter of the offer, it directly adds it to its neighborhood (because it already has a working socket with him). Thus, no answer comes through Pi. Therefore, the forwarding route is kept while it should be cleaned at some point.
Note that the pending socket of the emitter is clean after 'timeout'.

Example in nodejs

There is an inbrowser example. Yet, it does not implement all functionnalities of the network interface.

TODO: make a nodejs example using signaling service.

Double receipt of MStampedTicket

After the first step of #2, the links establish properly, nevertheless, the joining peer receive twice the message of the stamped ticket during the second connection establishment.

Configurable WebRTC parameters

Currently, connections are created using the default options provided by simple-peer. To do: give the possibility to configure the options.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.