Constructor Summary
| Public Constructor | ||
| public |
constructor(container: Container): PushContainer |
|
Member Summary
| Public Members | ||
| public get |
deviceID: String: * The device ID |
|
Method Summary
| Public Methods | ||
| public |
async registerDevice(token: string, type: string, topic: string): * You can register your device for receiving push notifications. |
|
| public |
async sendToDevice(devices: string | string[], notification: Object, topic: string): Object[] Send a push notification to specified devices. |
|
| public |
async sendToUser(users: string | string[], notification: Object, topic: string): Object[] Send a push notification to all devices associated with the specified users. |
|
| public |
async unregisterDevice(): * Unregisters the current user from the current device. |
|
Public Constructors
public constructor(container: Container): PushContainer source
Params:
| Name | Type | Attribute | Description |
| container | Container | the Skygear container |
Public Members
Public Methods
public async registerDevice(token: string, type: string, topic: string): * source
You can register your device for receiving push notifications.
Params:
| Name | Type | Attribute | Description |
| token | string | the device token |
|
| type | string | the device type (either 'ios' or 'android') |
|
| topic | string | the device topic, refer to application bundle identifier on iOS and application package name on Android |
Return:
| * |
public async sendToDevice(devices: string | string[], notification: Object, topic: string): Object[] source
Send a push notification to specified devices.
Params:
| Name | Type | Attribute | Description |
| devices | string | string[] | a list of Device IDs |
|
| notification | Object | push notification payload |
|
| notification.apns | Object | push notification payload for APNS |
|
| notification.gcm | Object | push notification payload for GCM |
|
| topic | string |
|
the device topic, refer to application bundle identifier on iOS and application package name on Android |
Return:
| Object[] | list of users to which notification was sent |
public async sendToUser(users: string | string[], notification: Object, topic: string): Object[] source
Send a push notification to all devices associated with the specified users.
Params:
| Name | Type | Attribute | Description |
| users | string | string[] | a list of User IDs |
|
| notification | Object | push notification payload |
|
| notification.apns | Object | push notification payload for APNS |
|
| notification.gcm | Object | push notification payload for GCM |
|
| topic | string |
|
the device topic, refer to application bundle identifier on iOS and application package name on Android |
Return:
| Object[] | list of users to which notification was sent |
public async unregisterDevice(): * source
Unregisters the current user from the current device. This should be called when the user logouts.
Return:
| * |
