JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q42221F
  • License ISC

A Bonjour/Zeroconf protocol implementation in JavaScript

Package Exports

  • aloha-sd

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aloha-sd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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

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

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.
The callback parameter should be a function that looks like this:
function (string error, Service result){...};
StringerrorThe error return from browsing
Service ObjectresultThe service return from browsing
String service_type Example: '_http._tcp'. List of known service_types here
Let it null for browse all.

finder.shutdown()

Stop looking for matching services.

Service

Service look like this

{
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.