@ambassify/eventbus
v1.0.3
Published
EventBus
Downloads
5
Keywords
Readme
EventBus-client
A client to publish events to eventbus
.
Installation
npm install --save eventbus-client
Usage
const EventBus = require('eventbus-client');
const eventbus = new EventBus({
endpoint: 'https://eventbus-endpoint'
});
eventbus.send('event_name', payload, options);
new EventBus()
new EventBus({ endpoint, [accessToken], [timeout] })
- endpoint: The endpoint of the eventbus service.
- accessToken: The accessToken to use when none was set for the
.send()
call. - timeout: The duration for which events are batched before publishing them.
.send()
.send(eventName, payload, options)
- eventName: The event to publish. Example:
item_created
- payload: Any object that can be serialized using
JSON.serialize
- options: An object with any one of the following options set:
- accessToken: This is required if not set when creating the eventbus instance.
- orgId: The organization ID to publish to.
- userId: The user ID to publish to.
- id: The ID of the object in
payload
- type: The type of the object in
payload