The PushSubscription interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service.

Documentation PushSubscription by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Constructor

new(initDict:PushSubscriptionInit)

Throws:

null

DOMError

Variables

read onlyendpoint:String

A USVString containing the endpoint associated with the push subscription.

read onlyoptions:PushSubscriptionOptions

An object containing the options used to create the subscription.

Methods

getKey(name:PushEncryptionKeyName):ArrayBuffer

Returns an ArrayBuffer which contains the client's public key, which can then be sent to a server and used in encrypting push message data.

Throws:

null

DOMError

toJSON():PushSubscriptionJSON

Standard serializer — returns a JSON representation of the subscription properties.

Throws:

null

DOMError

unsubscribe():Promise<Bool>

Starts the asynchronous process of unsubscribing from the push service, returning a Promise that resolves to a Boolean when the current subscription is successfully unregistered.

Throws:

null

DOMError