Notifications #
The realtime.subscribe method takes a callback argument, called with a notification object, whose properties depends on the type of notification received.
Document & messages #
These notifications represent documents changes & messages.
Property | Type | Description |
---|---|---|
action | string | API action |
collection | string | Collection name |
controller | string | API controller |
event | string | Event type (write , delete or publish ) |
index | string | Index name |
protocol | string | Network protocol used to modify the document |
result | object | Notification content |
room | string | Subscription channel identifier. Can be used to link a notification to its corresponding subscription |
scope | string | in : document enters (or stays) in the scopeout : document leaves the scope |
timestamp | number | Timestamp of the event, in Epoch-millis format |
type | string | document : Notification type |
volatile | object | Request volatile data |
The result
object is the notification content, and it has the following structure:
Property | Type | Description |
---|---|---|
_id | string | Document unique ID<br/null` if the notification is from a real-time message |
_source | object | Message or full document content. Not present if the event is about a document deletion |
User #
These notifications represent user events.
Property | Type | Description |
---|---|---|
action | string | API controller's action |
collection | string | Data collection |
controller | string | API controller |
index | string | Data index |
protocol | string | Network protocol used by the entering/leaving user |
result | object | Notification content |
room | string | Subscription channel identifier. Can be used to link a notification to its corresponding subscription |
timestamp | number | Timestamp of the event, in Epoch-millis format |
type | string | user : Notification type |
user | string | in : a new user has subscribed to the same filtersout : a user cancelled a shared subscription |
volatile | object | Request volatile data |
The result
object is the notification content, and it has the following structure:
Property | Type | Description |
---|---|---|
count | number | Updated users count sharing that same subscription |
Server #
These notifications represent server events.
Property | Type | Value |
---|---|---|
message | string | Server message explaining why this notification has been triggered |
type | string | TokenExpired : notification type |
Edit this page on Github(opens new window)