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.
npm install capacitor-zeroconf
npx cap sync
or
yarn add capacitor-zeroconf
yarn cap sync
'discover'
|
| **`listenerFunc`** | (result: ZeroConfWatchResult) => void
|
**Returns:** Promise<PluginListenerHandle>
--------------------
### getHostname()
```typescript
getHostname() => Promise<{ hostname: string; }>
```
**Returns:** Promise<{ hostname: string; }>
--------------------
### register(...)
```typescript
register(request: ZeroConfRegisterRequest) => PromiseZeroConfRegisterRequest
|
--------------------
### unregister(...)
```typescript
unregister(request: ZeroConfUnregisterRequest) => PromiseZeroConfUnregisterRequest
|
--------------------
### stop()
```typescript
stop() => PromiseZeroConfWatchRequest
|
| **`callback`** | ZeroConfWatchCallback
|
**Returns:** Promise<string>
--------------------
### unwatch(...)
```typescript
unwatch(request: ZeroConfUnwatchRequest) => PromiseZeroConfWatchRequest
|
--------------------
### close()
```typescript
close() => Promise() => 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