<commit_before># Gossip: Cyclon in Javascript

[![Build Status](https://travis-ci.org/nicola/js-gossip-cyclon.svg?style=flat-square)](https://travis-ci.org/nicola/js-gossip-cyclon)

This implements the Cyclon gossip protocol [1] for membership management.

## Cyclon

```js
const CyclonPeer = require('gossip-cyclon')
const parallel = require('run-parallel')

const Alice = new CyclonPeer()
const Bob = new CyclonPeer()

Alice.addPeers([Bob.me])

parallel([
  () => Alice.listen()
  () => Bob.listen()
], (err) => {
  if (!err) {
    Alice.start()
    Bob.start()
    // This will make Alice and Bob exchange each others information every 1 second
  }
})

```

#### var peer = new CyclonPeer(opts)

`opts` can have:
- `peer`: [PeerInfo](http://npm.im/peer-info) object of this CyclonPeer, default: `new PeerInfo()`.<commit_msg>new readme<commit_after># Gossip: Cyclon in Javascript

[![Build Status](https://travis-ci.org/nicola/js-gossip-cyclon.svg?style=flat-square)](https://travis-ci.org/nicola/js-gossip-cyclon)

This implements the Cyclon gossip protocol [1] for membership management.

## Cyclon

```js
const CyclonPeer = require('gossip-cyclon')
const parallel = require('run-parallel')

const Alice = new CyclonPeer()
const Bob = new CyclonPeer()

Alice.addPeers([Bob.me])

parallel([
  () => Alice.listen()
  () => Bob.listen()
], (err) => {
  if (!err) {
    Alice.start()
    Bob.start()
    // This will make Alice and Bob exchange each others information every 1 second
  }
})

```

## Run the simulation

```bash
$ git clone https://github.com/nicola/js-gossip-cyclon
$ cd js-gossip-cyclon
$ npm install
$ node viz/index.js
// Now visit http://127.0.0.1:8080
```

<img src="https://raw.githubusercontent.com/nicola/js-gossip-cyclon/master/simulation.png" width="500px">

#### var peer = new CyclonPeer(opts)

`opts` can have:
- `peer`: [PeerInfo](http://npm.im/peer-info) object of this CyclonPeer, default: `new PeerInfo()`.
{'fraction_non_alphanumeric': 0.17164948453608248, 'fraction_numerical': 0.008762886597938144, 'mean_word_length': 4.217741935483871, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1578596', 'n_tokens_mistral': 699, 'n_tokens_neox': 670, 'n_words': 161}