Notifications

Notifications are the bread and butter of Sockbot. They represent an incoming alert or message of some kind. This can be an event through a websocket, a notification email, or any alert that something has changed and needs to be processed.

Notification

All providers should offer a Notification object. A single Notification should represent a single Event.

Types

The following types of notification are well defined and assumed to exist:

Other types may exist depending on the provider.

Important note: Notification is responsible for handling the Commands object in order to support Command-type plugins. When a notification is spawned, a new Commands instance must be created. See the Command docs for more information.

Notification object: Properties

The following properties are assumed to exist, either as plain object properties or via getters:

Notification object: Expensive properties

The following methods each return a Promise for the property that they encapsulate. They should reject if no such property can exist.

Static: get

A static method should be provided to allow for retrieving arbitrary notifications. It will be given one arguments: the primary identifier for the notification.

This method should return a promise that will resolve to the requested Notification object.

Static: activate

A static method should be provided to begin listening for notifications. When called, it should begin sending Notifications through the Forum's eventEmitter.

The usual method of activation is to create a Parse method and listen for incoming messages or notification events emitted by the underlying connection to the forum. When an event occurs, the following should happen:

Static: deactivate

A static method should be provided to stop listening for notifications. When called, it should cease sending notification events or processing commands.