anternet-group
Anternet library for join and get other peers based on a group id.
Last updated 4 years ago by moshe .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install anternet-group 
SYNC missed versions from official npm registry.

anternet-group.js

build npm Join the chat at https://gitter.im/Anternet/anternet.js npm

Anternet library for join and get other peers based on a group id.

Example

const Anternet = require('anternet');
const Group = require('anternet-group');

const id = '<< hash >>'; 

const anternet = new Anternet();
const group = new Group(anternet, id);

// other peer address
const address = '127.0.0.1';
const port = 12345;

group.add(port, address);
console.log(group.size); // 1

// update and find more peers
group.update();

group.on('update', (found) => {
  console.log('peers found: ', found);
});

// get peers from other peer
group.get(port, address, (err, peers) => {
  if (err) throw err;
  
  peer.forEach(peer => console.log(`${peer.address}:${peer.port}`));
});

License

MIT License. Copyright © 2016 Moshe Simantov

Current Tags

  • 0.1.0                                ...           latest (4 years ago)

1 Versions

  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |