Chartbreaker
    Preparing search index...

    Interface 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. This information must be passed to the application server, using any desired application-specific method. Available only in secure contexts.

    MDN Reference

    interface PushSubscription {
        endpoint: string;
        expirationTime: number | null;
        options: PushSubscriptionOptions;
        getKey(name: PushEncryptionKeyName): ArrayBuffer | null;
        toJSON(): PushSubscriptionJSON;
        unsubscribe(): Promise<boolean>;
    }
    Index

    Properties

    endpoint: string

    The endpoint read-only property of the PushSubscription interface returns a string containing the endpoint associated with the push subscription.

    MDN Reference

    expirationTime: number | null

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

    MDN Reference

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

    MDN Reference

    Methods

    • 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.

      MDN Reference

      Parameters

      Returns ArrayBuffer | null

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

      MDN Reference

      Returns Promise<boolean>