Keywords: Random peer-sampling, adaptive, browser-to-browser communication, WebRTC
This project aims to provide a WebRTC implementation of Spray.
Spray  is a random peer-sampling protocol  inspired by both Cyclon  and Scamp . 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.
- An adaptive peer-sampling protocol for building networks of browsers (Journal WWW 2018)
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.
$ 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)
Peersim  simulations of Spray are available at peersim-spray.
 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.
 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.
 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.
 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.
 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.