multicast-service-discovery
TypeScript icon, indicating that this package has built-in type declarations

4.0.4 • Public • Published

multicast-service-discovery

Announce and look up services on a local network using mdns.

Install

npm i multicast-service-discovery

API docs

See the generated API docs.

Example usage

See the examples directory for a very basic example as well as usage with net.createServer and hypercore.

Announce a service

import { MdnsDiscovery } from 'multicast-service-discovery'

const discover = new MdnsDiscovery()

discover.announce('mdns-basic-example', { port: 3456 })

Look up a service

import { MdnsDiscovery } from 'multicast-service-discovery'

const discover = new MdnsDiscovery()

discover.on('service', (service) => {
  console.log('found service:', service)
})

discover.lookup('mdns-basic-example')

Troubleshooting

If you see Error: Timed out getting default route when using with nodejs versions >=18.0.0 to <18.4.0, upgrade to at least 18.4.0 to resolve this.

License

ISC

Readme

Keywords

Package Sidebar

Install

npm i multicast-service-discovery

Weekly Downloads

3

Version

4.0.4

License

ISC

Unpacked Size

29 kB

Total Files

27

Last publish

Collaborators

  • sethvincent