Zeroconf
This plugin allows you to browse and publish Zeroconf/Bonjour/mDNS services.
https://github.com/becvert/cordova-plugin-zeroconf
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation#
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-zeroconf $ npm install @ionic-native/zeroconf $ ionic cap sync
$ ionic cordova plugin add cordova-plugin-zeroconf $ npm install @ionic-native/zeroconf
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
#
Supported Platforms- Android
- iOS
#
Usage#
ReactLearn more about using Ionic Native components in React
#
Angularimport { Zeroconf } from '@ionic-native/zeroconf/ngx';
constructor(private zeroconf: Zeroconf) { }
...
// watch for services of a specified typethis.zeroconf.watch('_http._tcp.', 'local.').subscribe(result => { if (result.action == 'added') { console.log('service added', result.service); } else { console.log('service removed', result.service); }});
// publish a zeroconf service of your ownthis.zeroconf.register('_http._tcp.', 'local.', 'Becvert\'s iPad', 80, { 'foo': 'bar'}).then(result => { console.log('Service registered', result.service);});
// unregister your servicethis.zeroconf.unregister('_http._tcp.', 'local.', 'Becvert\'s iPad');