Construct EventHub instance with API credentials.
method(serverUrl, apiUser, apiKey[, options.applicationId])¶
- serverUrl (String) – Server URL
- apiUser (String) – API user
- apiKey (String) – API key
- options.applicationId (String) – Application identifier, added to event source.
Return true if connected to event server.
Return Boolean: Return true if connected to event server.
Publish event and return promise resolved with event id when event has been sent.
If onReply is specified, it will be invoked when any replies are received.
If timeout is non-zero, the promise will be rejected if the event is not sent before the timeout is reached. Should be specified as seconds and will default to 10.
Publish event and wait for a single reply.
Returns promise resolved with reply event if received within timeout.
Register to subscription events.
subscribe(subscription, callback[, metadata])¶
- subscription (String) – Expression to subscribe on. Currently, only “topic=value” expressions are supported.
- callback (function) – Function to be called when an event matching the subscription is returned.
- metadata (Object) – Optional information about subscriber.