# aloha-sd

> A Bonjour/Zeroconf protocol implementation in JavaScript

Latest version **1.0.7** (published 2017-05-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install aloha-sd
pnpm add aloha-sd
yarn add aloha-sd
bun add aloha-sd
```

Provides the command `aloha-sd`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2017-05-13 |
| First published | 2017-04-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | cuongurus |
| Maintainers | cuongurus |
| Keywords | zeroconf, bonjour, avahi, zero, configuration, mdns, sevice, discovery, publish, register, multicast, dns-sd |

## Links

- npm: https://www.npmjs.com/package/aloha-sd
- Homepage: https://github.com/cuongurus/aloha-sd
- Issues: https://github.com/cuongurus/aloha-sd/issues
- npm.io page: https://npm.io/package/aloha-sd

## Dependencies (3)

- [dns-txt](https://npm.io/package/dns-txt.md) ~2.0.2
- [commander](https://npm.io/package/commander.md) ~2.9.0
- [dns-packet](https://npm.io/package/dns-packet.md) ~1.1.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2017-05-13
- 1.0.6 — 2017-05-11
- 1.0.5 — 2017-05-03
- 1.0.4 — 2017-05-02
- 1.0.3 — 2017-04-24
- 1.0.2 — 2017-04-24
- 1.0.1 — 2017-04-24
- 1.0.0 — 2017-04-24

## README

# aloha-sd
A Bonjour/Zeroconf protocol implementation in pure JavaScript. Publish services on the local network or discover existing services using multicast DNS.

# Installation
npm install -g aloha-sd

# Usage
```js
var aloha = require('aloha-sd')

aloha.find((err, result) =>{
    if (err) console.log(err)

    if(result){
        console.log(JSON.stringify(result,null,4))
    }
},'_http._tcp')
```

# CLI
```
aloha-sd [options]
```

```
aloha-sd -l _http._tcp
```

Options:

| short | full | description |
| --- | --- | --- |
| -h | --help | output usage information |
| -V | --version | output the version number|
| -a | --all | Browse for all services, regardless of the type |
| -l "service type" | --lookup "service type" | Browse for specific service type |

# API
# Initializing
```js
var aloha = require('aloha-sd')
```

### Browsing
#### `var finder = aloha.findAll(callback)`
Browser for all services, regardless of the type

### `var finder = aloha.find(callback,service_type)`
Browser for all services with given service_type


| Type | Property | Description |
| --- | --- | --- |
| Function | callback | called when a service has been found.</br>The *callback* parameter should be a function that looks like this:</br>function (string error, Service result){...};</br><table><tr><td>String</td><td>error</td><td>The error return from browsing</td></tr><tr><td>Service Object</td><td>result</td><td>The service return from browsing</td></tr></table> |
| String | service_type | Example: '_http._tcp'. List of known service_types [here](https://github.com/cuongurus/Zeroconf-for-Chrome/blob/master/test/browser/service-types.js)</br>Let it null for browse all. |

### `finder.shutdown()`
Stop looking for matching services.

## Service
Service look like this
```js
{
name: string,
type: string,
fqdn: string,
host: string,
port: string,
ipv4: [],
ipv6: [],
txt: object,
status: boolean
}
```

### `Service.status`
A boolean indicating if the service is currently added (true) or removed (false)

## Publish
On development.

---
_Source: https://npm.io/package/aloha-sd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
