anternet-broadcast
v0.1.1
Published
Anternet library for broadcast messages to other peers that listening on the same channel.
Downloads
17
Maintainers
Readme
anternet-broadcast.js
Anternet library for broadcast messages to other peers that listening on the same channel.
Example
const Anternet = require('anternet');
const Broadcast = require('anternet-broadcast');
const msg = {a: 'Hello world', foo: 'bar'};
const anternet = new Anternet();
const broadcast = Broadcast.generate();
console.log(broadcast.publicKey); // print broadcast id string
// send messages to a given peer
const address = '127.0.0.1';
const port = 12345;
broadcast.send(anternet, msg, port, address);
License
MIT License. Copyright © 2016 Moshe Simantov