seal-mongo-notification
An event emitter and receiver that uses MongoDB capped collections.
Installation
$ npm install seal-mongo-notification
Quick start
First you need to add a reference to seal-mongo-notification to your application.
const mongoNotification = ;
Then connect to a MongoDB by calling the function mongoNotification
. Provide an options object and a callback:
;
The options contain:
url
mandatory, a connection string,topic
mandatory, the name of a topic collectionwriteOnly
optional, the open mode, default: false
Emit events
Call the emit
function for actually emitting an event:
notification;
Optionally you may specify a callback to get notified when the event has been persisted:
notification;
Receive events
If you want to receive events send by your application use the on
function:
notification;
Write only mode
If you only want to emit events but not receive any you can set the writeOnly
option to true
when connecting.
;
Running the build
To build this module use roboter.
$ bot