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()
This will initialize the scan from the Zeroconf
instance. Will stop another scan if any is running.
If any scan is running, stop it. Otherwise do nothing.
Will return all names of services that have been resolved.
zeroconf.on('start', () => console.log('The scan has started.'))
Broadcast a service name as soon as it is found.
Broadcast a service object once it is fully resolved
{
"host": "XeroxPrinter.local.",
"addresses": [
"192.168.1.23",
"fe80::aebc:123:ffff:abcd"
],
"name": "Xerox Printer",
"fullName": "XeroxPrinter.local._http._tcp.",
"port": 8080
}
Broadcast a service name removed from the network.