PushService (interface)
Interface for registering push tokens and handling push notifications for incoming calls.
Since: 5.2.0
Methods
handlePushNotification
handlePushNotification(notificationData: UnknownObject): Promise<void>
Reports a received push notification back to the Voximplant Cloud.
The notification data is sent as a JSON string within the notification data message,
available at the
messagePayload.data.voximplant
path. It should be parsed via
JSON.parse()
before being passed to this method.
If the user is not yet logged in, the request is queued and the data is sent automatically once the login process completes.
Returns a promise that resolves after the notification data is successfully sent to the cloud.
Since: 5.2.0
Parameters
Returns: Promise<void>
registerPushToken
registerPushToken(options: PushTokenOptions): Promise<void>
Registers a push token for the logged in user in the Voximplant cloud.
If the user is not yet logged in, the request is queued and sent automatically once the login process completes.
Returns a promise that resolves when the token is successfully registered.
Since: 5.2.0
Parameters
Returns: Promise<void>
Throws
- PushServiceInvalidTokenError – if the push token is empty or consists entirely of whitespace characters
- PushServiceConnectionClosedError – if the connection to the Voximplant cloud is closed before the request can complete
- PushServiceTimeoutError – if no response is received within the timeout period after the request is sent to the Voximplant cloud
- PushServiceCancelledError – if the pending request is canceled, typically when multiple registration or unregistration requests are made rapidly one after another
- PushServiceInternalError – if an internal error occurs
unregisterPushToken
unregisterPushToken(options: PushTokenOptions): Promise<void>
Unregisters a push token for the logged in user in the Voximplant cloud.
If the user is not yet logged in, the request is queued and sent automatically once the login process completes.
Returns a promise that resolves when the token is successfully unregistered.
Since: 5.2.0
Parameters
Returns: Promise<void>
Throws
- PushServiceInvalidTokenError – if the push token is empty or consists entirely of whitespace characters
- PushServiceConnectionClosedError – if the connection to the Voximplant cloud is closed before the request can complete
- PushServiceTimeoutError – if no response is received within the timeout period after the request is sent to the Voximplant cloud
- PushServiceCancelledError – if the pending request is canceled, typically when multiple registration or unregistration requests are made rapidly one after another
- PushServiceInternalError – if an internal error occurs