0.3.3 • Published 9 years ago

libp2p-mdns-discovery v0.3.3

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

libp2p-mdns-discovery JavaScript Implementation

npm.io npm.io npm.io

Node.js libp2p mDNS discovery implementation

Usage

var Sonar = require('libp2p-mdns-discovery')

var snr = new Sonar(peer, options, swarm)

snr.on('peer', function (peerInfo) {
  console.log('Found a peer in the local network', peerFound.id.toB58String())
})
  • peer - The peer that represents itself. Must be of a type peer-info
  • swarm - swarm, needed in order to verify if we are able to establish a connection with the other peer
  • options
    • broadcast - (true/false) announce our presence through mDNS
    • interval - query interval
    • serviceTag - name of the service announced (default to "discovery.ipfs.io.local")
    • verify - Verifies if we can establish a connection with the peer, before emitting a peer event