Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mafintosh/airswarm
Network swarm that automagically discovers other peers on the network using multicast dns
https://github.com/mafintosh/airswarm
Last synced: 7 days ago
JSON representation
Network swarm that automagically discovers other peers on the network using multicast dns
- Host: GitHub
- URL: https://github.com/mafintosh/airswarm
- Owner: mafintosh
- License: mit
- Created: 2015-09-08T01:27:15.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-07T20:02:28.000Z (over 8 years ago)
- Last Synced: 2024-10-23T06:07:37.739Z (16 days ago)
- Language: JavaScript
- Size: 104 KB
- Stars: 129
- Watchers: 9
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-peer-to-peer - airswarm
- awesome-peer-to-peer - airswarm
- awesome-network-js - airswarm
README
# airswarm
Network swarm that automagically discovers other peers on the network using multicast dns
```
npm install airswarm
```[![build status](http://img.shields.io/travis/mafintosh/airswarm.svg?style=flat)](http://travis-ci.org/mafintosh/airswarm)
## Usage
``` js
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
``` js
{
limit: maxPeersToConnectTo // defaults to Infinity
}
```#### `swarm.peers`
An array containing all the currently connected peers
## License
MIT