Skip to main content
Version: v6

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?

Don't waste precious time on plugin issues.

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

$ npm install cordova-plugin-zeroconf 
$ npm install @awesome-cordova-plugins/zeroconf
$ ionic cap sync

Supported Platforms

  • Android
  • iOS

Usage

React

Learn more about using Ionic Native components in React

Angular

import { Zeroconf } from '@awesome-cordova-plugins/zeroconf/ngx';

constructor(private zeroconf: Zeroconf) { }

...

// watch for services of a specified type
this.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 own
this.zeroconf.register('_http._tcp.', 'local.', 'Becvert\'s iPad', 80, {
'foo': 'bar'
}).then(result => {
console.log('Service registered', result.service);
});


// unregister your service
this.zeroconf.unregister('_http._tcp.', 'local.', 'Becvert\'s iPad');