yggio-subscriber: listen to the publisher
yggio-subscriber makes it easier to log in to yggio and subscribe to yggio events
Usage
Initialize (note that mongoose is injected as an argument)
// set up the subscriberconst app = ; // yeah, we need an express app..const subscriber = ;const onMessage = { };// the config is really the information-dense part of thisconst yggioConfig = messageRoute: '/yggio-message' rulesUrl: 'https://yggio-rules-example-url' yggioUrl: 'https://yggio-device-example-url' service: username: 'my-new-service@test.com' password: 'so-secret-so-secret' provider: name: 'MNS' info: 'My New Service Consolidated' redirect_uris: browser: 'https://login-redirect-example-url' app: 'mns://login' logoPath: './path/to/logo.png' ;const address = 'https://example-domain';// set the subscriber route message routesubscriber;
and then login:
subscriber ;
and now we can subscribe to iotnode changes published on the value exchange
const user = storm_access_token: 'something_special';const iotnodeId = 'asdf1234';subscriber;
and now the onMessage function should be working.
License
yggio-populate-request is under the MIT license. See LICENSE file.