This repository implements a lightweight, realtime nodejs based service discovery framework. It allows publishing service availability both through the local network and via a remote server. Local services are automatically made available remotely via Reverse SSH.
The package contains an executable named expose
which allows exposing a local service, starting the service visualizer and more.
Usage: cli [options]
Options:
--expose <name@host:port> Expose local service
--expose-metadata <metadata> Metadata in the form.
--launch-visualizer [port] Launch the visualizer service and and open it in the browser.
--no-activity-proxy Disable proxy service that transmits activity information to service visualizer.
--remote-host [hostname] Reverse SSH proxy host. (default: null)
--remote-user [username] Reverse SSH proxy user. (default: null)
--keyfile [path] Reverse SSH keyfile path. (default: null)
-h, --help output usage information
- publishService(serviceDescription)
Find a free port and set up automatic broadcasting via bonjour
- findServices(opts, callback)
Find services by type. Searches via multicast DNS / Bonjour and a remote but centralized server by default. Local services with the same name take preference over remote services.
- findAccumulatedServices(opts, callback, debounceTime)
Finds services and updates the callback with a debounced list of currently active services
- findServiceOnce(options)
Same as findService but returns a promise that resolves as soon as a service is found that meets the requirements
Find a free port and set up automatic broadcasting
Kind: global function
Param | Default | Description |
---|---|---|
serviceDescription |
|
Service configuration |
serviceDescription.isUnique | True if multiple services of the same name are allowed to coexist | |
serviceDescription.name | The service name. This is not used for discovery | |
serviceDescription.type | The service type. This is used for discovery. | |
serviceDescription.port | The port of the service to publish | |
serviceDescription.host | The host of the service to be published. Defaults to local host name. | |
serviceDescription.txt | Additional metadata to pass in the DNS TXT field |
Find services by type. Searches via multicast DNS / Bonjour and a remote but centralized server by default. Local services with the same name take preference over remote services.
Kind: global function
Param | Description |
---|---|
opts | |
opts.type | The service type (string) to find. |
callback | The callback is invoked with an object containing the boolean flag available which indicates whether the service went up or down and the service description. |
Finds services and updates the callback with a debounced list of currently active services
Kind: global function
Param | Default | Description |
---|---|---|
opts | Same as options of findservices | |
callback | Called with an object that contains the service names as keys and service details as values | |
debounceTime | 3000 |
Debounce time. So we don't update UIs when services disappear and appear in quick succession. |
Same as findService but returns a promise that resolves as soon as a service is found that meets the requirements
Kind: global function
Param |
---|
options |