multicast-dns-peer
Find peers using [multicast-dns](https://www.npmjs.com/package/multicast-dns).
Last updated 5 years ago by asbjornenge .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install multicast-dns-peer 
SYNC missed versions from official npm registry.

multicast-dns-peer

Find peers using multicast-dns.

Install

npm install --save multicast-dns-peer

Use

var mdp = require('multicast-dns-peer')('yolopeers')
mdp.on('peer', function(peer) {
    console.log(peer)
    mdp.destroy()
})

The default peer information is not very useful, it only contains the peer id. You'll typically want to add some additional answer records with connection information.

Options

var mdp = require('multicast-dns-peer')('yolopeers', {
    queryInterval : 2000, // how often to query for peers (default 5000)
    answers : [           // additional peer records 
        { 
            name : 'peer2', 
            type : 'A', 
            ttl  : 300, 
            data : '192.168.1.2' 
        },
        {
            name : 'yolo-service',
            type : 'SRV',
            data : {
                port   : 9999,
                target : 'yolo-service.yolopeers.com'
            }
        }
    ]
})

enjoy.

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 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 (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |