Notifications
Methods related to notifications for the current user.
AddNotificationListener
Add a listener to receive new notifications.
Returns: An EventSource instance listening for notifications. Use source.close() to close the listener.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
onMessage | function | ✓ | Callback invoked when a new notification is received |
Notifications
limit, // optional
tenantId, // optional
types, // optional
offsetId // optional
) → Promise.<Array.<Object>>
Retrieve notifications for the current user.
Returns: A list of notifications for the specified parameters
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | The maximum number of notifications to return (default:10) | |
tenantId | string | Filter notifications to only those related to the specified tenant | |
types | Array.<string> | Filter notifications to only the specified types | |
offsetId | string | Return notifications older than the specified ID |
PushNotification
tenantId,
eventType,
data, // optional
userAddress // optional
)
Push a notification to a user
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
tenantId | string | ✓ | The tenant associated with this notification |
eventType | string | ✓ | The type of the notification |
data | Object | string | Data associated with this notification | |
userAddress | string | Address of the user to notify. If not specified, it will be sent to the current user. |