1.0.7 • Published 8 years ago
aloha-sd v1.0.7
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._tcpOptions:
| 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 browsingService ObjectresultThe service return from browsing | 
| String | service_type | Example: '_http._tcp'. List of known service_types hereLet 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.