npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spray-wrtc

v2.0.11

Published

Adaptive random peer-sampling protocol running on top of WebRTC

Downloads

3,647

Readme

spray-wrtc Build Status JavaScript Style Guide

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.

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

API

You can find the API here.

Example

A usage example of this module is available here.

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.