Skip to content

A framework of libraries based on UDP protocol for peer-to-peer communications.

License

Notifications You must be signed in to change notification settings

Anternet/anternet.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anternet.js

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

Anternet is a framework of libraries based on UDP protocol for peer-to-peer communications.

Libraries

More libraries is on the way..

Example

const Anternet = require('anternet');

const msgType = 1; // can be any positive number
const address = '127.0.0.1';
const port = 12345;

  
// peer 1
const anternet1 = new Anternet();
anternet1.bind(port);

anternet1.on(msgType, (rid, args, rinfo) => {
  anternet1.response(rid, args.reverse(), rinfo.port, rinfo.address);
});

// peer 2
const anternet2 = new Anternet();
anternet2.request(msgType, ['foo', 'bar'], port, address, (err, args, rinfo) => {
  console.log(args); // [ "bar", "foo" ]
});

License

MIT License. Copyright © 2016 Moshe Simantov

About

A framework of libraries based on UDP protocol for peer-to-peer communications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published