1.0.3 • Published 4 years ago
@mangar2/remoteservice v1.0.3
Abstract
Interface to the opensense map service . Use it to send data to opensense map .
Provides a service to invoke broker messages from external networks . Allows only configured messages .
Contents
Meta
| File | index.js | 
| Abstract | Interface to the opensense map service . Use it to send data to opensense map . | 
| Author | Volker Böhm | 
| Copyright | Copyright ( c ) 2020 Volker Böhm | 
| License | This software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 . It is furnished "as is" , without any support , and with no warranty , express or implied , as to its usefulness for any purpose . | 
| File | remoteservice.js | 
| Abstract | Provides a service to invoke broker messages from external networks . Allows only configured messages . | 
| Author | Volker Böhm | 
| Copyright | Copyright ( c ) 2020 Volker Böhm | 
| License | This software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 . It is furnished "as is" , without any support , and with no warranty , express or implied , as to its usefulness for any purpose . | 
Type definitions
Service {Object}
Service configuration
| Name | Type | Description |
| ---- | ---- | ------- |
| path | string |  |  | path of the service | |
| reason | string |  |  | service usage information used as reason string | |
| qos | number | optional | 1 | quality of service | |
| devices | Object |  |  | key : topic list | |
Global functions
prepare
prepare (config, remoteService) => {RemoteService}
Prepares the object
prepare Parameters
| Name | Type | Attribute | Default | Description | |
|---|---|---|---|---|---|
| config | Object | remote service configuration | |||
| remoteService | RemoteService | optional | null | existing remote service class | 
prepare returns
| Type | Description | 
|---|---|
| RemoteService | the prepared remote service object | 
Class RemoteService
new RemoteService(options)
Creates a remote service
RemoteService Parameters
| Name | Type | Attribute | Default | Description | |
|---|---|---|---|---|---|
| options | Object | optional | { } | remote server parameter | 
options properties
| Name | Type | Description | |
|---|---|---|---|
| services | Array.<Service> | list of supported services | 
RemoteService Methods
close
async close ()
Closes the broker , stops listening
on
on (event, callback)
Sets a callback .
on Parameters
| Name | Type | Description | |
|---|---|---|---|
| event | string | event name ( not case sensitive ) for the callback | |
| callback | function | function ( . . . parameter ) | 
on throws
| Type | Description | 
|---|---|
| Error | if the event is not supported | 
| Error | if the callback is not 'function' | 
run
run ()
Listens to a configured port