Copyright © 2024World Wide Web Consortium.W3C®liability,trademark andpermissive document license rules apply.
ThePush API enables sending of apush message to a web application via apush service. Anapplication server can send apush message at any time, even when a web application oruser agent is inactive. Thepush service ensures reliable and efficient delivery to theuser agent.Push messages are delivered to aService Worker that runs in the origin of the web application, which can use the information in the message to update local state or display a notification to the user.
This specification is designed for use with theweb push protocol, which describes how anapplication server oruser agent interacts with apush service.
This section describes the status of this document at the time of its publication. A list of currentW3C publications and the latest revision of this technical report can be found in theW3C technical reports index at https://www.w3.org/TR/.
This document was published by theWeb Applications Working Group as a Working Draft using theRecommendation track.
Publication as a Working Draft does not imply endorsement byW3C and its Members.
This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under theW3C Patent Policy.W3C maintains apublic list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes containsEssential Claim(s) must disclose the information in accordance withsection 6 of theW3C Patent Policy.
This document is governed by the03 November 2023W3C Process Document.
This section is non-normative.
The Push API allows a web application to communicate with auser agent asynchronously. This allows anapplication server to provide theuser agent with time-sensitive information whenever that information becomes known, rather than waiting for a user to open the web application.
As defined here,push services support delivery ofpush messages at any time.
In particular, apush message will be delivered to the web application even if that web application is not currently active in a browser window: this relates to use cases in which the user may close the web application, but still benefits from the web application being able to be restarted when apush message is received. For example, apush message might be used to inform the user of an incoming WebRTC call.
Apush message can also be sent when theuser agent is temporarily offline. In support of this, thepush service stores messages for theuser agent until theuser agent becomes available. This supports use cases where a web application learns of changes that occur while a user is offline and ensures that theuser agent can be provided with relevant information in a timely fashion.Push messages are stored by thepush service until theuser agent becomes reachable and the message can be delivered.
The Push API will also ensure reliable delivery of push messages while auser agent is actively using a web application, for instance if a user is actively using the web application or the web application is in active communication with anapplication server through an active worker, frame, or background window. This is not the primary use case for the Push API. A web application might choose to use the Push API for infrequent messages to avoid having to maintain constant communications with theapplication server.
Push messaging is best suited to occasions where there is not already an active communications channel established between theuser agent and the web application. Sendingpush messages requires considerably more resources when compared with more direct methods of communication such as theFetch API or [WebSockets].Push messages usually have higher latency than direct communications and they can also be subject to restrictions on use. Mostpush services limit the size and quantity ofpush messages that can be sent.
Theweb push protocol [RFC8030] describes a protocol that enables communication between auser agent orapplication server and apush service. Alternative protocols could be used in place of this protocol, but this specification assumes the use of this protocol; alternative protocols are expected to provide compatible semantics.
TheContent-Encoding
HTTP header, described in Section 3.1.2.2 of [RFC7231], indicates the content coding applied to the payload of apush message.
The termapplication server refers to server-side components of a web application.
Apush message is data sent to a web application from anapplication server.
Apush message is delivered to theactive worker associated with thepush subscription to which the message was submitted. If the service worker is not currently running, the worker is started to enable delivery.
Apush subscription is a message delivery context established between theuser agent and thepush service on behalf of a web application. Eachpush subscription is associated with aservice worker registration and aservice worker registration has at most onepush subscription.
Apush subscription has an associatedpush endpoint. ItMUST be the absolute URL exposed by thepush service where theapplication server can sendpush messages to. Apush endpointMUST uniquely identify thepush subscription.
Apush subscriptionMAY have an associatedsubscription expiration time. When set, itMUST be the time, in milliseconds since 00:00:00 UTC on 1 January 1970, at which the subscription will bedeactivated. Theuser agentSHOULD attempt torefresh the push subscription before the subscription expires.
Apush subscription has internal slots for a P-256ECDH key pair and an authentication secret in accordance with [RFC8291]. These slotsMUST be populated when creating thepush subscription.
If theuser agent has to change the keys for any reason, itMUSTfire the "pushsubscriptionchange
" event with theservice worker registration associated with thepush subscription asregistration, aPushSubscription
instance representing thepush subscription having the old keys asoldSubscription and aPushSubscription
instance representing thepush subscription having the new keys asnewSubscription.
Tocreate a push subscription, given anPushSubscriptionOptionsInit
optionsDictionary:
PushSubscription
.PushSubscriptionOptions
object, initializing its attributes with the corresponding members and values ofoptionsDictionary.options
attribute tooptions.getKey
()
method of thePushSubscription
with an argument of "p256dh
".getKey
()
method of thePushSubscription
with an argument of "auth
".applicationServerKey
attribute ofoptions when it has been set. Rethrow anyexceptions.endpoint
attribute to thepush subscription'spush endpoint.expirationTime
.Auser agent orpush serviceMAY choose torefresh apush subscription at any time, for example because it has reached a certain age.
When this happens, theuser agentMUST run the steps tocreate a push subscription given thePushSubscriptionOptions
that were provided for creating the currentpush subscription. The newpush subscriptionMUST have a key pair that's different from the original subscription.
When successful,user agent thenMUSTfire the "pushsubscriptionchange
" event with theservice worker registration associated with thepush subscription asregistration, aPushSubscription
instance representing the initialpush subscription asoldSubscription and aPushSubscription
instance representing the newpush subscription asnewSubscription.
To allow for time to propagate changes toapplication servers, auser agentMAY continue to accept messages for an oldpush subscription for a brief time after a refresh. Once messages have been received for a refreshedpush subscription, any oldpush subscriptionsMUST bedeactivated.
If theuser agent is not able to refresh thepush subscription, itSHOULD periodically retry the refresh. When thepush subscription can no longer be used, for example because it has expired, theuser agentMUSTfire the "pushsubscriptionchange
" event with theservice worker registration associated with thepush subscription asregistration, aPushSubscription
instance representing the deactivatingpush subscription asoldSubscription andnull
as thenewSubscription.
When apush subscription isdeactivated, both theuser agent and thepush serviceMUST delete any stored copies of its details. Subsequentpush messages for thispush subscriptionMUST NOT be delivered.
Apush subscription isdeactivated when its associatedservice worker registration is unregistered, though apush subscriptionMAY bedeactivated earlier.
Apush subscription is removed whenservice worker registration is cleared.
The termpush service refers to a system that allowsapplication servers to sendpush messages to a web application. A push service serves thepush endpoint orendpoints for thepush subscriptions it serves.
Theuser agent connects to thepush service used to createpush subscriptions.User agentsMAY limit the choice ofpush services available. Reasons for doing so include performance-related concerns such as service availability (including whether services are blocked by firewalls in specific countries, or networks at workplaces and the like), reliability, impact on battery lifetime, and agreements to steer metadata to, or away from, specificpush services.
The Push API is apowerful feature identified by thename"push".
For integration with thePermissions specification, this specification defines thePushPermissionDescriptor
permission descriptor type.
WebIDLdictionaryPushPermissionDescriptor
:PermissionDescriptor {booleanuserVisibleOnly
= false;};
TheuserVisibleOnly
has the same semantics asuserVisibleOnly
.
{name: "push", userVisibleOnly: false}
isstronger than{name: "push", userVisibleOnly: true}
.
The contents of apush message are encrypted [RFC8291]. However, thepush service is still exposed to the metadata of messages sent by anapplication server to auser agent over apush subscription. This includes the timing, frequency and size of messages. Other than changingpush services, which user agents may disallow, the only known mitigation is to increase the apparent message size by padding.
There is no guarantee that apush message was sent by anapplication server having the same origin as the web application. Theapplication server is able to share the details necessary to use apush subscription with a third party at its own discretion.
The following requirements are intended to protect the privacy and security of the user as far as possible, and subject to meeting that goal, to protect the integrity of theapplication server's communication with the user.
User agentsMUST NOT provide Push API access to web applications without theexpress permission of the user.User agentsMUST acquire consent for permission through a user interface for each call to thesubscribe()
method, unless a previous permission grant has been persisted, or a prearranged trust relationship applies. Permissions that are preserved beyond the current browsing sessionMUST be revocable.
The Push API may have to wake up the Service Worker associated with theservice worker registration in order to run the developer-provided event handlers. This can cause resource usage, such as network traffic, that theuser agentSHOULD attribute to the web application that created thepush subscription.
Theuser agentMAY consider thePushSubscriptionOptions
when acquiring permission or determining the permission status.
When a permission is revoked, theuser agentMAYfire the "pushsubscriptionchange
" event for subscriptions created with that permission, with theservice worker registration associated with thepush subscription asregistration, aPushSubscription
instance representing thepush subscription asoldSubscription, andnull
asnewSubscription. Theuser agentMUSTdeactivate the affected subscriptions in parallel.
When aservice worker registration is unregistered, any associatedpush subscriptionMUST bedeactivated.
Thepush endpointMUST NOT expose information about the user to be derived by actors other than thepush service, such as the user's device, identity or location. See the Privacy Considerations in [RFC8030] for the exact requirements.
Thepush endpoint of adeactivatedpush subscriptionMUST NOT be reused for a newpush subscription. This prevents the creation of a persistent identifier that the user cannot remove. This also prevents reuse of the details of onepush subscription to sendpush messages to anotherpush subscription.
User agentsMUST implement the Push API to only be available in asecure context. This provides better protection for the user against man-in-the-middle attacks intended to obtain push subscription data. Browsers may ignore this rule for development purposes only.
This section is non-normative.
Apush message is sent from anapplication server to a web application as follows:
This overall framework allowsapplication servers to activate aService Worker in response to events at theapplication server. Information about those events can be included in thepush message, which allows the web application to react appropriately to those events, potentially without needing to initiate network requests.
The following code and diagram illustrate a hypothetical use of the push API.
This section is non-normative.
// https://example.com/serviceworker.jsthis.onpush =event => {console.log(event.data);// From here we can write the data to IndexedDB, send it to any open// windows, display a notification, etc.}// https://example.com/webapp.js// inside an async function...try {const serviceWorkerRegistration =await navigator.serviceWorker.register("serviceworker.js" );const pushSubscription =await serviceWorkerRegistration.pushManager.subscribe();// The push subscription details needed by the application// server are now available, and can be sent to it using,// for example, an XMLHttpRequest.console.log(pushSubscription.endpoint);console.log(pushSubscription.getKey("p256dh"));console.log(pushSubscription.getKey("auth"));}catch (err) {// In a production environment it might make sense to// also report information about errors back to the// application server.console.log(error);}
This section is non-normative.
The fields included in thePushSubscription
is all the information needed for anapplication server to send apush message. Push services that are compatible with the Push API provide apush endpoint that conforms to theweb push protocol. These parameters and attributes include:
PushSubscription
is a URL that allows anapplication server to request delivery of apush message to a web application.getKey
()
method on aPushSubscription
is used to retrieve keying material used to encrypt and authenticatepush messages. Each invocation of the function returns a newArrayBuffer
that contains the value of the corresponding key, ornull
if the identified key doesn't exist. Passing a value of "p256dh
" retrieves aelliptic curve Diffie-Hellman (ECDH) public key associated with thepush subscription. Passing a value ofauth
returns an authentication secret that an application server uses in authentication of its messages. These keys are used by theapplication server to encrypt and authenticate messages for thepush subscription, as described in [RFC8291]. The Service Worker specification defines aServiceWorkerRegistration
interface [SERVICE-WORKERS], which this specification extends.
WebIDL[SecureContext]partial interfaceServiceWorkerRegistration { readonly attributePushManager
pushManager
;};
ThepushManager
attribute exposes aPushManager
, which has an associatedservice worker registration represented by theServiceWorkerRegistration
on which the attribute is exposed.
ThePushManager
interface defines the operations to accesspush services.
WebIDL[Exposed=(Window,Worker),SecureContext]interfacePushManager
{ [SameObject] static readonly attributeFrozenArray<DOMString>supportedContentEncodings
;Promise<PushSubscription
>subscribe
(optionalPushSubscriptionOptionsInit
options = {});Promise<PushSubscription
?>getSubscription
();Promise<PermissionState>permissionState
(optionalPushSubscriptionOptionsInit
options = {});};
ThesupportedContentEncodings
attribute exposes the sequence of supported content codings that can be used to encrypt the payload of apush message. A content coding is indicated using theContent-Encoding
header field when requesting the sending of apush message from thepush service.
User agentsMUST support theaes128gcm
content coding defined in [RFC8291], andMAY support content codings defined in previous versions of the draft for compatibility reasons.
Thesubscribe()
method when invokedMUST run the following steps:
Because of implementation-specific reasons, user agents are known to do some of the following checks in different order (e.g., some check ifuserVisibleOnly
is allowed after validating theapplicationServerKey
, and vice versa). However, we don't believe this affects interoperability of implementations or web applications.
userVisibleOnly
value set tofalse
and the user agent requires it to betrue
,queue a global task on thenetworking task source usingglobal torejectpromise "NotAllowedError
"DOMException
applicationServerKey
member, and thepush service requires one to be given,queue a global task on thenetworking task source usingglobal torejectpromise with a "NotSupportedError
"DOMException
.applicationServerKey
attribute, run the following sub-steps:applicationServerKey
is aDOMString
, set its value to anArrayBuffer
containing the sequence of octets that result from decodingoptions'sapplicationServerKey
using the base64url encoding [RFC7515].InvalidCharacterError
"DOMException
and terminate these steps.applicationServerKey
describes a valid point on the P-256 curve. If its value is invalid,queue a global task on thenetworking task source usingglobal torejectpromise with an "InvalidAccessError
"DOMException
and terminate these steps.InvalidStateError
"DOMException
and terminate these steps.denied
",queue a global task on theuser interaction task source usingglobal torejectpromise with a "NotAllowedError
"DOMException
and terminate these steps.AbortError
"DOMException
and terminate these steps.options
attribute ofsubscription. The contents ofBufferSource
values are compared for equality rather thanreference.InvalidStateError
"DOMException
and terminate these steps.PushSubscription
providing the details of the newsubscription. ThegetSubscription
method when invokedMUST run the following steps:
DOMException
whose name is "AbortError
" and terminate these steps.PushSubscription
providing the details of the retrievedpush subscription. ThepermissionState()
method when invokedMUST run the following steps:
PermissionDescriptor
with thename
initialized to "push".Permission to use the push service can be persistent, that is, it does not need to be reconfirmed for subsequent subscriptions if a valid permission exists.
If there is a need to ask for permission, it needs to be done by invoking thesubscribe
()
method.
WebIDL[Exposed=(Window,Worker),SecureContext]interfacePushSubscriptionOptions
{ readonly attributebooleanuserVisibleOnly
; [SameObject] readonly attributeArrayBuffer?applicationServerKey
;};
TheuserVisibleOnly
attribute, when getting, returns the value it was initialized with.
TheapplicationServerKey
attribute, when getting, returns the value it was initialized with.
If present, the value ofapplicationServerKey
MUST include a point on the P-256 elliptic curve [DSS], encoded in the uncompressed form described in [ANSI-X9-62] Annex A (that is, 65 octets, starting with an 0x04 octet). When provided as aDOMString
, the valueMUST be encoded using the base64url encoding [RFC7515].
User agentsMAY reject a subscription attempt whenapplicationServerKey
is not present and thepush service requires one for operational reasons.
TheapplicationServerKey
MUST be a different value to the one used for message encryption [RFC8291].
WebIDLdictionaryPushSubscriptionOptionsInit
{booleanuserVisibleOnly
= false; (BufferSource orDOMString)?applicationServerKey
= null;};
TheuserVisibleOnly
member, when set totrue
, indicates that thepush subscription will only be used forpush messages whose effect is made visible to the user, for example by displaying a Web Notification. [NOTIFICATIONS]
APushSubscriptionOptionsInit
represents additional options associated with apush subscription. Theuser agentMAY consider these options when requestingexpress permission from the user. When an option is considered, theuser agentSHOULD enforce it on incomingpush messages.
These options are optional, anduser agentsMAY choose to support only a subset of them. Auser agentMUST NOT expose options that it does not support.
Once set, options for apush subscription cannot change. A pre-existingpush subscription can be unsubscribed, viaunsubscribe
, to create apush subscription with new options.
TheapplicationServerKey
member is used by theuser agent when establishing apush subscription with apush service. TheapplicationServerKey
option includes an elliptic curve public key for anapplication server. This is the key that theapplication server will use to authenticate itself when sendingpush messages to thispush subscription as defined in [RFC8292]; thepush service will reject anypush message unless the corresponding private key is used to generate an authentication token.
APushSubscription
object represents apush subscription.
WebIDL[Exposed=(Window,Worker),SecureContext]interfacePushSubscription
{ readonly attributeUSVStringendpoint
; readonly attributeEpochTimeStamp?expirationTime
; [SameObject] readonly attributePushSubscriptionOptions
options
;ArrayBuffer?getKey
(PushEncryptionKeyName
name);Promise<boolean>unsubscribe
();PushSubscriptionJSON
toJSON
();};dictionaryPushSubscriptionJSON
{USVStringendpoint
;EpochTimeStamp?expirationTime
= null;record<DOMString,USVString>keys
;};
Whengetting theendpoint
attribute, theuser agentMUST return thepush endpoint associated with thepush subscription. Theuser agentMUST use a serialization method that does not contain input-dependent branches (that is, one that is constant time).
Whengetting theexpirationTime
attribute, theuser agentMUST return thesubscription expiration time associated with thepush subscription if there is one, ornull
otherwise.
When getting theoptions
attribute, theuser agentMUST return aPushSubscriptionOptions
object representing the options associated with thepush subscription.
ThegetKey()
method retrieves keying material that can be used for encrypting and authenticating messages. WhengetKey
()
is invoked the following process is followed:
name
argument.null
.ArrayBuffer
instance.p256dh
" public key is encoded using the uncompressed format defined in [ANSI-X9-62] Annex A (that is, a 65 octet sequence that starts with a 0x04 octet).auth
parameter contains an octet sequence used by theuser agent to authenticate messages sent by anapplication server. Keys named "p256dh
" and "auth
"MUST be supported, and their valuesMUST correspond to those necessary for the user agent to decrypt received push messages in accordance with [RFC8291].
Theunsubscribe()
method when invokedMUST run the following steps:
false
and terminate these steps.If theuser agent failed to request thepush service todeactivate thepush subscription, for example because of network failures, itSHOULD retry the request to thepush service for a reasonable amount of time.
true
. ThetoJSON()
method when invokedMUST run the following steps:
PushSubscriptionJSON
dictionary.endpoint
attribute ofthis.expirationTime
attribute ofthis.record<DOMString, USVString>
.PushSubscription
, ordered by the name of the key:getKey
()
).getKey
.USVString
. Theuser agentMUST use a serialization method that does not branch based on the value ofb. APushSubscriptionJSON
dictionary represents theJSON type of aPushSubscription
. In ECMAScript this can be converted into a JSON string through theJSON
.stringify
()
function.
Thekeys
record contains an entry for each of the supportedPushEncryptionKeyName
entries to the URL-safe base64 encoded representation [RFC4648] of its value.
Note that the options to aPushSubscription
are not serialized.
Encryption keys used forpush message encryption are provided to a web application through thegetKey
()
method or the serializer ofPushSubscription
. Each key is named using a value from thePushEncryptionKeyName
enumeration.
WebIDLenumPushEncryptionKeyName
{"p256dh
","auth
"};
Thep256dh
value is used to retrieve the P-256ECDH Diffie-Hellman public key described in [RFC8291].
Theauth
value is used to retrieve the authentication secret described in [RFC8291].
WebIDL[Exposed=ServiceWorker,SecureContext]interfacePushMessageData
{ArrayBufferarrayBuffer
();Blobblob
();Uint8Arraybytes
();anyjson
();USVStringtext
();};
PushMessageData
objects have an associatedbytes (abyte sequence), which is set on creation.
ThearrayBuffer()
method steps are to return anArrayBuffer
whose contents arethis'sbytes. Exceptions thrown during the creation of theArrayBuffer
object are re-thrown.
Theblob()
method steps are to return a newBlob
object whose contents arethis'sbytes.
Thebytes()
method steps are to return a newUint8Array
backed by aArrayBuffer
whose contents arethis'sbytes. Exceptions thrown during the creation of theArrayBuffer
object are re-thrown.
Thejson()
method steps are to return the result ofparsing JSON bytes to a JavaScript value giventhis'sbytes.
Thetext()
method steps are to return the result of runningUTF-8 decode onthis'sbytes.
Toextract a byte sequence fromobject, run these steps:
BufferSource
USVString
The Service Worker specification defines aServiceWorkerGlobalScope
interface [SERVICE-WORKERS], which this specification extends.
WebIDL[Exposed=ServiceWorker,SecureContext]partial interfaceServiceWorkerGlobalScope { attributeEventHandleronpush
; attributeEventHandleronpushsubscriptionchange
;};
Theonpush
attribute is anevent handler IDL attribute whose correspondingevent handler event type is "push
". The "push
" event indicates that apush message has been received for apush subscription.
Theonpushsubscriptionchange
attribute is anevent handler IDL attribute whose correspondingevent handler event type is "pushsubscriptionchange
".
WebIDL[Exposed=ServiceWorker,SecureContext]interfacePushEvent
:ExtendableEvent {constructor
(DOMStringtype, optionalPushEventInit
eventInitDict = {}); readonly attributePushMessageData
?data
;};
When aconstructor
of thePushEvent
interface, or of an interface that inherits from thePushEvent
interface, is invoked, the usualevent constructing steps are extended to include the following steps:
data
member is not present, set thedata
attribute of the event tonull
and terminate these steps.data
" member ofeventInitDict.data
attribute of the event to a newPushMessageData
instance withbytes
set tob. Thedata
, when getting, returns the value it was initialized with.
WebIDLtypedef (BufferSource orUSVString)PushMessageDataInit
;dictionaryPushEventInit
:ExtendableEventInit {PushMessageDataInit
data
;};
Thedata
member contains the data included in thepush message when included and theuser agent verified its authenticity. The value will be set tonull
in all other cases.
When theuser agent receives apush message from thepush service, itMUST run the following steps.
Apush
event will not be fired for apush message that was not successfully decrypted using the key pair associated with thepush subscription.
Fire a functional event named "push
" usingPushEvent
onregistration with the following properties:
data
PushMessageData
object whosebytes isbytes.Then run the following steps in parallel, withdispatchedEvent:
If the samepush message has been delivered to aservice worker registration multiple times unsuccessfully, acknowledge the receipt of thepush message according to [RFC8030].
Acknowledging thepush message causes thepush service to stop delivering the message and to report success to theapplication server. This prevents the samepush message from being retried by thepush service indefinitely.
Acknowledging also means that anapplication server could incorrectly receive a delivery receipt indicating successful delivery of thepush message. Therefore, multiple rejectionsSHOULD be permitted before acknowledging; allowing at least three attempts is recommended.
Thepushsubscriptionchange event indicates a change in apush subscription that was triggered outside of the application's control, for example because it has been refreshed, revoked or lost.
Tofire the "pushsubscriptionchange
" event given aservice worker registration ofregistration,newSubscription andoldSubscription, theuser agent mustfire a functional event named "pushsubscriptionchange
" usingPushSubscriptionChangeEvent
onregistration with the following properties:
newSubscription
oldSubscription
Consider using a more reliable synchronization mechanism such as [WEB-BACKGROUND-SYNC] when sending the details of the newpush subscription to yourapplication server. The user might be subject to unreliable network conditions that could cause a fetch to fail.
WebIDL[Exposed=ServiceWorker,SecureContext]interfacePushSubscriptionChangeEvent
:ExtendableEvent {constructor
(DOMStringtype, optionalPushSubscriptionChangeEventInit
eventInitDict = {}); readonly attributePushSubscription
?newSubscription
; readonly attributePushSubscription
?oldSubscription
;};
ThenewSubscription
attribute, when getting, returns the value it was initialized to.
TheoldSubscription
attribute, when getting, returns the value it was initialized to.
WebIDLdictionaryPushSubscriptionChangeEventInit
:ExtendableEventInit {PushSubscription
newSubscription
= null;PushSubscription
oldSubscription
= null;};
ThenewSubscription
member details thepush subscription that is valid per invocation of thepushsubscriptionchange event. The value will benull
when no newpush subscription could be established, for example because the web application has lostexpress permission.
TheoldSubscription
member details thepush subscription thatSHOULD NOT be used anymore. The value will benull
when theuser agent is not able to provide the full set of details, for example because of partial database corruption.
ThePush API does not provide any means itself to present data it receives from apush service. Instead, thePush API relies on other APIs – primarily theNotifications API Standard – to present received information to an end user. As such, there are no accessibility requirements for thePush API itself. However, specifications such as [NOTIFICATIONS] provide guidance how to present notifications in an accessible manner.
Further, presenting an accessible interface might depend on transferring more information than a push message can convey. Push messages are best suited to carrying small amounts of content or identifiers. Any larger resources need to be fetched from servers.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key wordsMAY,MUST,MUST NOT,SHOULD, andSHOULD NOT in this document are to be interpreted as described inBCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
This specification defines conformance criteria that apply to a single product: theuser agent that implements the interfaces that it contains.
WebIDLdictionaryPushPermissionDescriptor
:PermissionDescriptor {booleanuserVisibleOnly
= false;};[SecureContext]partial interfaceServiceWorkerRegistration { readonly attributePushManager
pushManager
;};[Exposed=(Window,Worker),SecureContext]interfacePushManager
{ [SameObject] static readonly attributeFrozenArray<DOMString>supportedContentEncodings
;Promise<PushSubscription
>subscribe
(optionalPushSubscriptionOptionsInit
options = {});Promise<PushSubscription
?>getSubscription
();Promise<PermissionState>permissionState
(optionalPushSubscriptionOptionsInit
options = {});};[Exposed=(Window,Worker),SecureContext]interfacePushSubscriptionOptions
{ readonly attributebooleanuserVisibleOnly
; [SameObject] readonly attributeArrayBuffer?applicationServerKey
;};dictionaryPushSubscriptionOptionsInit
{booleanuserVisibleOnly
= false; (BufferSource orDOMString)?applicationServerKey
= null;};[Exposed=(Window,Worker),SecureContext]interfacePushSubscription
{ readonly attributeUSVStringendpoint
; readonly attributeEpochTimeStamp?expirationTime
; [SameObject] readonly attributePushSubscriptionOptions
options
;ArrayBuffer?getKey
(PushEncryptionKeyName
name);Promise<boolean>unsubscribe
();PushSubscriptionJSON
toJSON
();};dictionaryPushSubscriptionJSON
{USVStringendpoint
;EpochTimeStamp?expirationTime
= null;record<DOMString,USVString>keys
;};enumPushEncryptionKeyName
{"p256dh
","auth
"};[Exposed=ServiceWorker,SecureContext]interfacePushMessageData
{ArrayBufferarrayBuffer
();Blobblob
();Uint8Arraybytes
();anyjson
();USVStringtext
();};[Exposed=ServiceWorker,SecureContext]partial interfaceServiceWorkerGlobalScope { attributeEventHandleronpush
; attributeEventHandleronpushsubscriptionchange
;};[Exposed=ServiceWorker,SecureContext]interfacePushEvent
:ExtendableEvent {constructor
(DOMStringtype, optionalPushEventInit
eventInitDict = {}); readonly attributePushMessageData
?data
;};typedef (BufferSource orUSVString)PushMessageDataInit
;dictionaryPushEventInit
:ExtendableEventInit {PushMessageDataInit
data
;};[Exposed=ServiceWorker,SecureContext]interfacePushSubscriptionChangeEvent
:ExtendableEvent {constructor
(DOMStringtype, optionalPushSubscriptionChangeEventInit
eventInitDict = {}); readonly attributePushSubscription
?newSubscription
; readonly attributePushSubscription
?oldSubscription
;};dictionaryPushSubscriptionChangeEventInit
:ExtendableEventInit {PushSubscription
newSubscription
= null;PushSubscription
oldSubscription
= null;};
The editors would like to express their gratitude to the Mozilla and Telefónica Digital teams implementing the Firefox OS Push message solution, as well as to the following people who provided significant technical input to this document: Antonio Amaya, Miguel García Arribas, Ben Bangert, Kit Cambridge, José Manuel Cantera, JR Conlin, Albert Crespell, Matt Gaunt, Phil Jenvey, Guillermo López, Nikhil Marathe, John Mellor, Pınar Özlen, Fernando R. Sela, Shijun Sun and Doug Turner.
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in:
Referenced in: