📡 Discover Zeroconf services using react-native
Objective-C Java JavaScript
Latest commit f29579f Nov 19, 2016 @Apercu style(android): minor space


react-native-zeroconf Week Stars

Basic Zeroconf implementation for React-native

Get running services advertizing themselves using Zeroconf implementations like Avahi, Bonjour or NSD.


npm i -S react-native-zeroconf
react-native install react-native-zeroconf
react-native link react-native-zeroconf

You can look at the wiki if you prefer a manual install.


import Zeroconf from 'react-native-zeroconf'
const zeroconf = new Zeroconf()
scan(type = 'http', protocol = 'tcp', domain = 'local.') Start the zeroconf scan

This will initialize the scan from the Zeroconf instance. Will stop another scan if any is running.

stop() Stop the scan

If any scan is running, stop it. Otherwise do nothing.

getServices() Returns resolved services

Will return all names of services that have been resolved.

zeroconf.on('start', () => console.log('The scan has started.'))
start Triggered on scan start
stop Triggered on scan stop
found Triggered when a service is found

Broadcast a service name as soon as it is found.

resolved Triggered when a service is resolved

Broadcast a service object once it is fully resolved

  "host": "XeroxPrinter.local.",
  "addresses": [
  "name": "Xerox Printer",
  "fullName": "XeroxPrinter.local._http._tcp.",
  "port": 8080
remove Triggered when a service is removed

Broadcast a service name removed from the network.

update Triggered either when a service is found or removed
error Triggered when an error occurs