HTML5 (Javascript) Client Reference
Class notifications
Language: Javascript (HTML5)
The Notifications service. This class is used for registering mobile endpoints and sending mobile push notifications to other users.
Example
Refresh and list the user's registered endpoints:
Example
Registering a notification endpoint for the current client:
Example
Sending a notification:
Properties | ||||
---|---|---|---|---|
|
||||
Methods | ||||
|
||||
|
||||
|
||||
|
||||
|
notifications.myEndpoints
|
The list of registered endpoints for the current user. You must call refresh() first to initialize this list.
notifications.deleteEndpoints
|
Deletes the given endpoints
Arguments
endpoints:notificationEndpoint[] | |
The endpoints to delete | |
successCallback:function() | |
Callback function that will be called when the operation has been completed. | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs. |
notifications.refresh
|
Refresh the notification endpoints of the current user.
Arguments
successCallback:function() | |
Callback function that will be called when the refresh is complete | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs |
notifications.registerEndpoint
|
Register a device or endpoint with Player.IO
Arguments
endpointType:string | |
Endpoint type, such as, IOS, Android, email, etc. | |
identifier:string | |
The identifier of the endpoint, such as the device token on iOS or an email address for email. | |
configuration:object | |
Configuration relating to the endpoint. Can be null. | |
enabled:bool | |
Should the endpoint be enabled | |
successCallback:function() | |
Callback function that will be called when the operation has been completed. | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs. |
notifications.send
|
Send one or more notifications
Arguments
notifications:object[] | |
The notifications to send | |
successCallback:function() | |
Callback function that will be called when the operation has been completed. | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs. |
notifications.toggleEndpoints
|
Enables or disabled the given endpoints
Arguments
endpoints:notificationEndpoint[] | |
The endpoints to enable or disable. | |
enabled:bool | |
If true, all the given endpoints will be enabled. If false, they'll be disabled. | |
successCallback:function() | |
Callback function that will be called when the operation has been completed. | |
errorCallback:function(PlayerIOError) | |
Callback function that will be called if an error occurs. |