All Projects → mafintosh → Airswarm

mafintosh / Airswarm

Licence: mit
Network swarm that automagically discovers other peers on the network using multicast dns

Programming Languages

javascript
184084 projects - #8 most used programming language

airswarm

Network swarm that automagically discovers other peers on the network using multicast dns

npm install airswarm

build status

Usage

var airswarm = require('airswarm')

airswarm('testing', function (sock) {
  sock.write('hello world (' + process.pid + ')\n')
  sock.pipe(process.stdout)
})

If you run the above program in a couple of processes on the same local network the swarms should start connecting to each other and write hello world

API

swarm = airswarm(name, [options], [onpeer])

Create a new swarm. The swarm will emit peer everytime a new peer is connected. Optionally you can pass a peer listener as the second argument.

The peer will be a tcp stream to another swarm.

Options include

{
  limit: maxPeersToConnectTo // defaults to Infinity
}

swarm.peers

An array containing all the currently connected peers

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].