PushSubscription

The PushSubscription interface of the Push API provides a subscription's URL endpoint along with the public key and secrets that should be used for encrypting push messages to this subscription. Available only in secure contexts.

MDN Reference

Properties

Link copied to clipboard

The endpoint read-only property of the the endpoint associated with the push subscription.

Link copied to clipboard

The expirationTime read-only property of the of the subscription expiration time associated with the push subscription, if there is one, or null otherwise.

Link copied to clipboard

The options read-only property of the PushSubscription interface is an object containing the options used to create the subscription.

Functions

Link copied to clipboard

The getKey() method of the PushSubscription interface returns an ArrayBuffer representing a client public key, which can then be sent to a server and used in encrypting push message data.

Link copied to clipboard

The toJSON() method of the PushSubscription interface is a standard serializer: it returns a JSON representation of the subscription properties, providing a useful shortcut.

Link copied to clipboard
suspend fun unsubscribe(): Boolean

The unsubscribe() method of the PushSubscription interface returns a Promise that resolves to a boolean value when the current subscription is successfully unsubscribed.

Link copied to clipboard