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.
Properties
The expirationTime
read-only property of the of the subscription expiration time associated with the push subscription, if there is one, or null
otherwise.
The options
read-only property of the PushSubscription interface is an object containing the options used to create the subscription.
Functions
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.
The toJSON()
method of the PushSubscription interface is a standard serializer: it returns a JSON representation of the subscription properties, providing a useful shortcut.
The unsubscribe()
method of the PushSubscription interface returns a Promise that resolves to a boolean value when the current subscription is successfully unsubscribed.