capacitor-zeroconf
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

capacitor-zeroconf

Capacitor ZeroConf plugin

This plugin allows you to browse and publish ZeroConf/Bonjour/mDNS services from applications developed using Ionic's Capacitor.

This is not a background service. When the cordova view is destroyed/terminated, publish and watch operations are stopped.

Android, iOS and Electron platforms are supported.

The has been ported from Cordova ZeroConf Plugin.

Install

npm install capacitor-zeroconf
npx cap sync

or

yarn add capacitor-zeroconf
yarn cap sync

API

addListener('discover', ...)

addListener(eventName: 'discover', listenerFunc: (result: ZeroConfWatchResult) => void) => PluginListenerHandle
Param Type
eventName 'discover'
listenerFunc (result: ZeroConfWatchResult) => void

Returns: PluginListenerHandle


getHostname()

getHostname() => Promise<{ hostname: string; }>

Returns: Promise<{ hostname: string; }>


register(...)

register(request: ZeroConfRegisterRequest) => Promise<void>
Param Type
request ZeroConfRegisterRequest

unregister(...)

unregister(request: ZeroConfUnregisterRequest) => Promise<void>
Param Type
request ZeroConfUnregisterRequest

stop()

stop() => Promise<void>

watch(...)

watch(request: ZeroConfWatchRequest, callback?: ZeroConfWatchCallback | undefined) => Promise<CallbackID>
Param Type
request ZeroConfWatchRequest
callback ZeroConfWatchCallback

Returns: Promise<string>


unwatch(...)

unwatch(request: ZeroConfUnwatchRequest) => Promise<void>
Param Type
request ZeroConfWatchRequest

close()

close() => Promise<void>

Interfaces

PluginListenerHandle

Prop Type
remove () => Promise<void>

ZeroConfService

Prop Type
domain string
type string
name string
port number
hostname string
ipv4Addresses string[]
ipv6Addresses string[]
txtRecord { [key: string]: string; }

ZeroConfRegisterRequest

Prop Type
port number
props { [key: string]: string; }

ZeroConfUnregisterRequest

Prop Type
name string

ZeroConfWatchRequest

Prop Type
type string
domain string

Type Aliases

ZeroConfWatchResult

{ action: ZeroConfWatchAction; service: ZeroConfService; }

ZeroConfWatchAction

'added' | 'removed' | 'resolved'

ZeroConfWatchCallback

(event: ZeroConfWatchResult): void

CallbackID

string

ZeroConfUnwatchRequest

ZeroConfWatchRequest

Package Sidebar

Install

npm i capacitor-zeroconf

Weekly Downloads

177

Version

2.0.0

License

MIT

Unpacked Size

88.3 kB

Total Files

52

Last publish

Collaborators

  • trik