SDK
SDK Javascript v7.x
2

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.

PropertyTypeDescription
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 scope
out: 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:

PropertyTypeDescription
_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.

PropertyTypeDescription
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 filters
out: a user cancelled a shared subscription
volatile
object
Request volatile data

The result object is the notification content, and it has the following structure:

PropertyTypeDescription
count
number
Updated users count sharing that same subscription

Server #

These notifications represent server events.

PropertyTypeValue
message
string
Server message explaining why this notification has been triggered
type
string
TokenExpired: notification type