Sombrero Gossip
To be used as part of a Sombrero Node. Implements a gossip protocol over a set of peers.
Install
$ npm install sombrero-gossip
Require and Create
var Gossip = ;var options = port: 7000;var gossip = ;
Options:
port
: defaults to 8217peers
: array of peers, each containing an id, hostname and port attributesinterval
: the interval with which it contacts other nodes
API
gossip.addPeer(peer)
Add a peer. A peer must have the following attributes:
- id
- hostname
- port
gossip.removePeer(peerId)
Removes a peer.
gossip.cluster.set(key, value)
Set a gossip value on the cluster.
gossip.cluster.get(key)
Returns the current known value.
License
ISC