CINXE.COM

Push API

<!DOCTYPE html><html lang="en-US"><head> <meta charset="utf-8"> <meta name="generator" content="ReSpec 35.1.1"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <style> span.example-title{text-transform:none} :is(aside,div).example,div.illegal-example{padding:.5em;margin:1em 0;position:relative;clear:both} div.illegal-example{color:red} div.illegal-example p{color:#000} aside.example div.example{border-left-width:.1em;border-color:#999;background:#fff} </style> <style> .issue-label{text-transform:initial} .warning>p:first-child{margin-top:0} .warning{padding:.5em;border-left-width:.5em;border-left-style:solid} span.warning{padding:.1em .5em .15em} .issue.closed span.issue-number{text-decoration:line-through} .issue.closed span.issue-number::after{content:" (Closed)";font-size:smaller} .warning{border-color:#f11;border-color:var(--warning-border,#f11);border-width:.2em;border-style:solid;background:#fbe9e9;background:var(--warning-bg,#fbe9e9);color:#000;color:var(--text,#000)} .warning-title:before{content:"⚠";font-size:1.3em;float:left;padding-right:.3em;margin-top:-.3em} li.task-list-item{list-style:none} input.task-list-item-checkbox{margin:0 .35em .25em -1.6em;vertical-align:middle} .issue a.respec-gh-label{padding:5px;margin:0 2px 0 2px;font-size:10px;text-transform:none;text-decoration:none;font-weight:700;border-radius:4px;position:relative;bottom:2px;border:none;display:inline-block} </style> <style> pre.idl{padding:1em;position:relative} pre.idl>code{color:#000;color:var(--text,#000)} @media print{ pre.idl{white-space:pre-wrap} } .idlHeader{display:block;width:150px;background:#8ccbf2;background:var(--def-border,#8ccbf2);color:#fff;color:var(--defrow-border,#fff);font-family:sans-serif;font-weight:700;margin:-1em 0 1em -1em;height:28px;line-height:28px} .idlHeader a.self-link{margin-left:.3cm;text-decoration:none;border-bottom:none;color:inherit} .idlID{font-weight:700;color:#005a9c} .idlType{color:#005a9c} .idlName{color:#ff4500} .idlName a{color:#ff4500;border-bottom:1px dotted #ff4500;text-decoration:none} a.idlEnumItem{color:#000;border-bottom:1px dotted #ccc;text-decoration:none} .idlSuperclass{font-style:italic;color:#005a9c} .idlDefaultValue,.idlParamName{font-style:italic} .extAttr{color:#666} .idlSectionComment{color:gray} .idlIncludes a{font-weight:700} .respec-button-copy-paste:focus{text-decoration:none;border-color:#51a7e8;outline:0;box-shadow:0 0 5px rgba(81,167,232,.5)} .respec-button-copy-paste:is(:focus:hover,.selected:focus){border-color:#51a7e8} .respec-button-copy-paste:is(:hover,:active,.zeroclipboard-is-hover,.zeroclipboard-is-active){text-decoration:none;background-color:#ddd;background-image:linear-gradient(#eee,#ddd);border-color:#ccc} .respec-button-copy-paste:is(:active,.selected,.zeroclipboard-is-active){background-color:#dcdcdc;background-image:none;border-color:#b5b5b5;box-shadow:inset 0 2px 4px rgba(0,0,0,.15)} .respec-button-copy-paste.selected:hover{background-color:#cfcfcf} .respec-button-copy-paste:is(:disabled,:disabled:hover,.disabled,.disabled:hover){color:rgba(102,102,102,.5);cursor:default;background-color:rgba(229,229,229,.5);background-image:none;border-color:rgba(197,197,197,.5);box-shadow:none} @media print{ .respec-button-copy-paste{visibility:hidden} } </style> <style> dfn{cursor:pointer} .dfn-panel{position:absolute;z-index:35;min-width:300px;max-width:500px;padding:.5em .75em;margin-top:.6em;font-family:"Helvetica Neue",sans-serif;font-size:small;background:#fff;background:var(--indextable-hover-bg,#fff);color:#000;color:var(--text,#000);box-shadow:0 1em 3em -.4em rgba(0,0,0,.3),0 0 1px 1px rgba(0,0,0,.05);box-shadow:0 1em 3em -.4em var(--tocsidebar-shadow,rgba(0,0,0,.3)),0 0 1px 1px var(--tocsidebar-shadow,rgba(0,0,0,.05));border-radius:2px} .dfn-panel:not(.docked)>.caret{position:absolute;top:-9px} .dfn-panel:not(.docked)>.caret::after,.dfn-panel:not(.docked)>.caret::before{content:"";position:absolute;border:10px solid transparent;border-top:0;border-bottom:10px solid #fff;border-bottom-color:var(--indextable-hover-bg,#fff);top:0} .dfn-panel:not(.docked)>.caret::before{border-bottom:9px solid #a2a9b1;border-bottom-color:var(--indextable-hover-bg,#a2a9b1)} .dfn-panel *{margin:0} .dfn-panel b{display:block;color:#000;color:var(--text,#000);margin-top:.25em} .dfn-panel ul a[href]{color:#333;color:var(--text,#333)} .dfn-panel>div{display:flex} .dfn-panel a.self-link{font-weight:700;margin-right:auto} .dfn-panel .marker{padding:.1em;margin-left:.5em;border-radius:.2em;text-align:center;white-space:nowrap;font-size:90%;color:#040b1c} .dfn-panel .marker.dfn-exported{background:#d1edfd;box-shadow:0 0 0 .125em #1ca5f940} .dfn-panel .marker.idl-block{background:#8ccbf2;box-shadow:0 0 0 .125em #0670b161} .dfn-panel a:not(:hover){text-decoration:none!important;border-bottom:none!important} .dfn-panel a[href]:hover{border-bottom-width:1px} .dfn-panel ul{padding:0} .dfn-panel li{margin-left:1em} .dfn-panel.docked{position:fixed;left:.5em;top:unset;bottom:2em;margin:0 auto;max-width:calc(100vw - .75em * 2 - .5em - .2em * 2);max-height:30vh;overflow:auto} </style> <title>Push API</title> <style id="respec-mainstyle"> @keyframes pop{ 0%{transform:scale(1,1)} 25%{transform:scale(1.25,1.25);opacity:.75} 100%{transform:scale(1,1)} } a.internalDFN{color:inherit;border-bottom:1px solid #99c;text-decoration:none} a.externalDFN{color:inherit;border-bottom:1px dotted #ccc;text-decoration:none} a.bibref{text-decoration:none} .respec-offending-element:target{animation:pop .25s ease-in-out 0s 1} .respec-offending-element,a[href].respec-offending-element{text-decoration:red wavy underline} @supports not (text-decoration:red wavy underline){ .respec-offending-element:not(pre){display:inline-block} .respec-offending-element{background:url(data:image/gif;base64,R0lGODdhBAADAPEAANv///8AAP///wAAACwAAAAABAADAEACBZQjmIAFADs=) bottom repeat-x} } #references :target{background:#eaf3ff;animation:pop .4s ease-in-out 0s 1} cite .bibref{font-style:normal} a[href].orcid{padding-left:4px;padding-right:4px} a[href].orcid>svg{margin-bottom:-2px} ol.tof,ul.tof{list-style:none outside none} .caption{margin-top:.5em;font-style:italic} #issue-summary>ul{column-count:2} #issue-summary li{list-style:none;display:inline-block} details.respec-tests-details{margin-left:1em;display:inline-block;vertical-align:top} details.respec-tests-details>*{padding-right:2em} details.respec-tests-details[open]{z-index:999999;position:absolute;border:thin solid #cad3e2;border-radius:.3em;background-color:#fff;padding-bottom:.5em} details.respec-tests-details[open]>summary{border-bottom:thin solid #cad3e2;padding-left:1em;margin-bottom:1em;line-height:2em} details.respec-tests-details>ul{width:100%;margin-top:-.3em} details.respec-tests-details>li{padding-left:1em} .self-link:hover{opacity:1;text-decoration:none;background-color:transparent} aside.example .marker>a.self-link{color:inherit} .header-wrapper{display:flex;align-items:baseline} :is(h2,h3,h4,h5,h6):not(#toc>h2,#abstract>h2,#sotd>h2,.head>h2){position:relative;left:-.5em} :is(h2,h3,h4,h5,h6):not(#toch2)+a.self-link{color:inherit;order:-1;position:relative;left:-1.1em;font-size:1rem;opacity:.5} :is(h2,h3,h4,h5,h6)+a.self-link::before{content:"§";text-decoration:none;color:var(--heading-text)} :is(h2,h3)+a.self-link{top:-.2em} :is(h4,h5,h6)+a.self-link::before{color:#000} @media (max-width:767px){ dd{margin-left:0} } @media print{ .removeOnSave{display:none} } </style> <meta name="color-scheme" content="light"> <meta name="revision" content="53fc46529183943a4574abc28adec493a0c3042a"> <meta name="description" content="The Push API enables sending of a push message to a web application via a push service. An application server can send a push message at any time, even when a web application or user agent is inactive. The push service ensures reliable and efficient delivery to the user agent. Push messages are delivered to a Service 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."> <link rel="canonical" href="https://www.w3.org/TR/push-api/"> <style> .hljs{--base:#fafafa;--mono-1:#383a42;--mono-2:#686b77;--mono-3:#717277;--hue-1:#0b76c5;--hue-2:#336ae3;--hue-3:#a626a4;--hue-4:#42803c;--hue-5:#ca4706;--hue-5-2:#c91243;--hue-6:#986801;--hue-6-2:#9a6a01} @media (prefers-color-scheme:dark){ .hljs{--base:#282c34;--mono-1:#abb2bf;--mono-2:#818896;--mono-3:#5c6370;--hue-1:#56b6c2;--hue-2:#61aeee;--hue-3:#c678dd;--hue-4:#98c379;--hue-5:#e06c75;--hue-5-2:#be5046;--hue-6:#d19a66;--hue-6-2:#e6c07b} } .hljs{display:block;overflow-x:auto;padding:.5em;color:#383a42;color:var(--mono-1,#383a42);background:#fafafa;background:var(--base,#fafafa)} .hljs-comment,.hljs-quote{color:#717277;color:var(--mono-3,#717277);font-style:italic} .hljs-doctag,.hljs-formula,.hljs-keyword{color:#a626a4;color:var(--hue-3,#a626a4)} .hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#ca4706;color:var(--hue-5,#ca4706);font-weight:700} .hljs-literal{color:#0b76c5;color:var(--hue-1,#0b76c5)} .hljs-addition,.hljs-attribute,.hljs-meta-string,.hljs-regexp,.hljs-string{color:#42803c;color:var(--hue-4,#42803c)} .hljs-built_in,.hljs-class .hljs-title{color:#9a6a01;color:var(--hue-6-2,#9a6a01)} .hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801;color:var(--hue-6,#986801)} .hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#336ae3;color:var(--hue-2,#336ae3)} .hljs-emphasis{font-style:italic} .hljs-strong{font-weight:700} .hljs-link{text-decoration:underline} </style> <style> var{position:relative;cursor:pointer} var[data-type]::after,var[data-type]::before{position:absolute;left:50%;top:-6px;opacity:0;transition:opacity .4s;pointer-events:none} var[data-type]::before{content:"";transform:translateX(-50%);border-width:4px 6px 0 6px;border-style:solid;border-color:transparent;border-top-color:#222} var[data-type]::after{content:attr(data-type);transform:translateX(-50%) translateY(-100%);background:#222;text-align:center;font-family:"Dank Mono","Fira Code",monospace;font-style:normal;padding:6px;border-radius:3px;color:#daca88;text-indent:0;font-weight:400} var[data-type]:hover::after,var[data-type]:hover::before{opacity:1} </style> <script id="initialUserConfig" type="application/json">{ "specStatus": "WD", "shortName": "push-api", "previousMaturity": "WD", "editors": [ { "name": "Peter Beverloo", "company": "Google", "companyURL": "https://www.google.com/", "w3cid": "44819" }, { "name": "Martin Thomson", "company": "Mozilla Foundation", "companyURL": "https://www.mozilla.org/", "w3cid": "68503" }, { "name": "Marcos Caceres", "company": "Apple Inc.", "companyURL": "https://www.apple.com/", "w3cid": "39125" } ], "group": "webapps", "github": "w3c/push-api", "xref": "web-platform", "gitRevision": "53fc46529183943a4574abc28adec493a0c3042a", "publishDate": "2024-09-03", "previousPublishDate": "2024-09-03", "publishISODate": "2024-09-03T00:00:00.000Z", "generatedSubtitle": "W3C Working Draft 03 September 2024" }</script> <link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2021/W3C-WD"></head> <body data-cite="WEBIDL service-workers FILEAPI secure-contexts hr-time permissions ECMASCRIPT HTML INFRA URL WEBIDL DOM FETCH" class="h-entry"><div class="head"> <p class="logos"><a class="logo" href="https://www.w3.org/"><img crossorigin="" alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a></p> <h1 id="title" class="title">Push API</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types#WD">W3C Working Draft</a> <time class="dt-published" datetime="2024-09-03">03 September 2024</time></p> <details open=""> <summary>More details about this document</summary> <dl> <dt>This version:</dt><dd> <a class="u-url" href="https://www.w3.org/TR/2024/WD-push-api-20240903/">https://www.w3.org/TR/2024/WD-push-api-20240903/</a> </dd> <dt>Latest published version:</dt><dd> <a href="https://www.w3.org/TR/push-api/">https://www.w3.org/TR/push-api/</a> </dd> <dt>Latest editor's draft:</dt><dd><a href="https://w3c.github.io/push-api/">https://w3c.github.io/push-api/</a></dd> <dt>History:</dt><dd> <a href="https://www.w3.org/standards/history/push-api/">https://www.w3.org/standards/history/push-api/</a> </dd><dd> <a href="https://github.com/w3c/push-api/commits/">Commit history</a> </dd> <dt>Editors:</dt><dd class="editor p-author h-card vcard" data-editor-id="44819"> <span class="p-name fn">Peter Beverloo</span> (<a class="p-org org h-org" href="https://www.google.com/">Google</a>) </dd><dd class="editor p-author h-card vcard" data-editor-id="68503"> <span class="p-name fn">Martin Thomson</span> (<a class="p-org org h-org" href="https://www.mozilla.org/">Mozilla Foundation</a>) </dd><dd class="editor p-author h-card vcard" data-editor-id="39125"> <span class="p-name fn">Marcos Caceres</span> (<a class="p-org org h-org" href="https://www.apple.com/">Apple Inc.</a>) </dd> <dt> Former editors: </dt><dd class="editor p-author h-card vcard"> <span class="p-name fn">Bryan Sullivan</span> (<a class="p-org org h-org" href="http://www.att.com/">AT&amp;T</a>) - Until <time datetime="2015-05-01">01 May 2015</time> </dd><dd class="editor p-author h-card vcard"> <span class="p-name fn">Eduardo Fullea</span> (<a class="p-org org h-org" href="http://www.telefonica.com/">Telefonica</a>) - Until <time datetime="2015-05-01">01 May 2015</time> </dd><dd class="editor p-author h-card vcard"> <span class="p-name fn">Michaël van Ouwerkerk</span> (<a class="p-org org h-org" href="https://www.google.com/">Google</a>) - Until <time datetime="2016-11-08">08 November 2016</time> </dd> <dt>Feedback:</dt><dd> <a href="https://github.com/w3c/push-api/">GitHub w3c/push-api</a> (<a href="https://github.com/w3c/push-api/pulls/">pull requests</a>, <a href="https://github.com/w3c/push-api/issues/new/choose">new issue</a>, <a href="https://github.com/w3c/push-api/issues/">open issues</a>) </dd> </dl> </details> <p class="copyright"> <a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a rel="license" href="https://www.w3.org/copyright/software-license-2023/" title="W3C Software and Document Notice and License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <section id="abstract" class="introductory"><h2>Abstract</h2> <p> The <cite>Push API</cite> enables sending of a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-1">push message</a> to a web application via a <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-1">push service</a>. An <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-1">application server</a> can send a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-2">push message</a> at any time, even when a web application or <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-1">user agent</a> is inactive. The <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-2">push service</a> ensures reliable and efficient delivery to the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-2">user agent</a>. <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-3">Push messages</a> are delivered to a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker">Service Worker</a> 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. </p> <p> This specification is designed for use with the <a href="#dfn-web-push-protocol" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-web-push-protocol-1">web push protocol</a>, which describes how an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-2">application server</a> or <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-3">user agent</a> interacts with a <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-3">push service</a>. </p> </section> <section id="sotd" class="introductory"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em></p><p> This document was published by the <a href="https://www.w3.org/groups/wg/webapps">Web Applications Working Group</a> as a Working Draft using the <a href="https://www.w3.org/policies/process/20231103/#recs-and-notes">Recommendation track</a>. </p><p>Publication as a Working Draft does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. </p><p> 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. </p><p> This document was produced by a group operating under the <a href="https://www.w3.org/policies/patent-policy/"><abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a rel="disclosure" href="https://www.w3.org/groups/wg/webapps/ipr">public list of any patent disclosures</a> 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 contains <a href="https://www.w3.org/policies/patent-policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/policies/patent-policy/#sec-Disclosure">section 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. </p><p> This document is governed by the <a id="w3c_process_revision" href="https://www.w3.org/policies/process/20231103/">03 November 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>. </p></section><nav id="toc"><h2 class="introductory" id="table-of-contents">Table of Contents</h2><ol class="toc"><li class="tocline"><a class="tocxref" href="#abstract">Abstract</a></li><li class="tocline"><a class="tocxref" href="#sotd">Status of This Document</a></li><li class="tocline"><a class="tocxref" href="#introduction"><bdi class="secno">1. </bdi> Introduction </a></li><li class="tocline"><a class="tocxref" href="#dependencies"><bdi class="secno">2. </bdi> Dependencies </a></li><li class="tocline"><a class="tocxref" href="#concepts"><bdi class="secno">3. </bdi> Concepts </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#application-server"><bdi class="secno">3.1 </bdi> Application server </a></li><li class="tocline"><a class="tocxref" href="#push-message"><bdi class="secno">3.2 </bdi> Push message </a></li><li class="tocline"><a class="tocxref" href="#push-subscription"><bdi class="secno">3.3 </bdi> Push subscription </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#subscription-refreshes"><bdi class="secno">3.3.1 </bdi> Subscription Refreshes </a></li><li class="tocline"><a class="tocxref" href="#subscription-deactivation"><bdi class="secno">3.3.2 </bdi> Subscription Deactivation </a></li></ol></li><li class="tocline"><a class="tocxref" href="#push-service"><bdi class="secno">3.4 </bdi> Push service </a></li><li class="tocline"><a class="tocxref" href="#permission"><bdi class="secno">3.5 </bdi> Permission </a></li></ol></li><li class="tocline"><a class="tocxref" href="#security-and-privacy-considerations"><bdi class="secno">4. </bdi> Security and privacy considerations </a></li><li class="tocline"><a class="tocxref" href="#pushframework"><bdi class="secno">5. </bdi> Push Framework </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#example"><bdi class="secno">5.1 </bdi> Example </a></li><li class="tocline"><a class="tocxref" href="#sequence-diagram"><bdi class="secno">5.2 </bdi> Sequence diagram </a></li><li class="tocline"><a class="tocxref" href="#push-service-use"><bdi class="secno">5.3 </bdi> Push service use </a></li></ol></li><li class="tocline"><a class="tocxref" href="#extensions-to-the-serviceworkerregistration-interface"><bdi class="secno">6. </bdi> Extensions to the <code>ServiceWorkerRegistration</code> Interface </a></li><li class="tocline"><a class="tocxref" href="#pushmanager-interface"><bdi class="secno">7. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="PushManager" data-dfn-for=""><code>PushManager</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#subscribe-method"><bdi class="secno">7.1 </bdi> <code>subscribe()</code> method </a></li><li class="tocline"><a class="tocxref" href="#pushsubscriptionoptions-interface"><bdi class="secno">7.2 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="PushSubscriptionOptions" data-dfn-for=""><code>PushSubscriptionOptions</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#pushsubscriptionoptionsinit-dictionary"><bdi class="secno">7.3 </bdi> <span data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="PushSubscriptionOptionsInit" data-dfn-for=""><code>PushSubscriptionOptionsInit</code></span> dictionary </a></li></ol></li><li class="tocline"><a class="tocxref" href="#pushsubscription-interface"><bdi class="secno">8. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="PushSubscription" data-dfn-for=""><code>PushSubscription</code></span> interface </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#pushencryptionkeyname-enumeration"><bdi class="secno">8.1 </bdi> <span data-export="" data-dfn-type="enum" data-idl="enum" data-title="PushEncryptionKeyName" data-dfn-for=""><code>PushEncryptionKeyName</code></span> enumeration </a></li></ol></li><li class="tocline"><a class="tocxref" href="#pushmessagedata-interface"><bdi class="secno">9. </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="PushMessageData" data-dfn-for=""><code>PushMessageData</code></span> interface </a></li><li class="tocline"><a class="tocxref" href="#events"><bdi class="secno">10. </bdi> Events </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#extensions-to-the-serviceworkerglobalscope-interface"><bdi class="secno">10.1 </bdi> Extensions to the <code>ServiceWorkerGlobalScope</code> interface </a></li><li class="tocline"><a class="tocxref" href="#pushevent-interface"><bdi class="secno">10.2 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="PushEvent" data-dfn-for=""><code>PushEvent</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#pusheventinit-dictionary"><bdi class="secno">10.3 </bdi> <span data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="PushEventInit" data-dfn-for=""><code>PushEventInit</code></span> dictionary </a></li><li class="tocline"><a class="tocxref" href="#receiving-a-push-message"><bdi class="secno">10.4 </bdi> Receiving a <span class="formerLink" data-link-type="dfn">Push Message</span> </a></li><li class="tocline"><a class="tocxref" href="#the-pushsubscriptionchange-event"><bdi class="secno">10.5 </bdi> The <span>pushsubscriptionchange</span> Event </a><ol class="toc"><li class="tocline"><a class="tocxref" href="#pushsubscriptionchangeevent-interface"><bdi class="secno">10.5.1 </bdi> <span data-export="" data-dfn-type="interface" data-idl="interface" data-title="PushSubscriptionChangeEvent" data-dfn-for=""><code>PushSubscriptionChangeEvent</code></span> Interface </a></li><li class="tocline"><a class="tocxref" href="#pushsubscriptionchangeeventinit-interface"><bdi class="secno">10.5.2 </bdi> <span data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="PushSubscriptionChangeEventInit" data-dfn-for=""><code>PushSubscriptionChangeEventInit</code></span> Interface </a></li></ol></li></ol></li><li class="tocline"><a class="tocxref" href="#accessibility"><bdi class="secno">11. </bdi> Accessibility </a></li><li class="tocline"><a class="tocxref" href="#conformance"><bdi class="secno">12. </bdi>Conformance</a></li><li class="tocline"><a class="tocxref" href="#idl-index"><bdi class="secno">A. </bdi>IDL Index</a></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><bdi class="secno">B. </bdi> Acknowledgements </a></li><li class="tocline"><a class="tocxref" href="#references"><bdi class="secno">C. </bdi>References</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><bdi class="secno">C.1 </bdi>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><bdi class="secno">C.2 </bdi>Informative references</a></li></ol></li></ol></nav> <section class="informative" id="introduction"><div class="header-wrapper"><h2 id="x1-introduction"><bdi class="secno">1. </bdi> Introduction </h2><a class="self-link" href="#introduction" aria-label="Permalink for Section 1."></a></div><p><em>This section is non-normative.</em></p> <p> The Push API allows a web application to communicate with a <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-4">user agent</a> asynchronously. This allows an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-3">application server</a> to provide the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-5">user agent</a> with time-sensitive information whenever that information becomes known, rather than waiting for a user to open the web application. </p> <p> As defined here, <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-4">push services</a> support delivery of <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-4">push messages</a> at any time. </p> <p> In particular, a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-5">push message</a> 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 a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-6">push message</a> is received. For example, a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-7">push message</a> might be used to inform the user of an incoming WebRTC call. </p> <p> A <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-8">push message</a> can also be sent when the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-6">user agent</a> is temporarily offline. In support of this, the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-5">push service</a> stores messages for the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-7">user agent</a> until the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-8">user agent</a> becomes available. This supports use cases where a web application learns of changes that occur while a user is offline and ensures that the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-9">user agent</a> can be provided with relevant information in a timely fashion. <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-9">Push messages</a> are stored by the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-6">push service</a> until the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-10">user agent</a> becomes reachable and the message can be delivered. </p> <p> The Push API will also ensure reliable delivery of push messages while a <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-11">user agent</a> 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 an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-4">application server</a> 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 the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-5">application server</a>. </p> <p> Push messaging is best suited to occasions where there is not already an active communications channel established between the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-12">user agent</a> and the web application. Sending <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-10">push messages</a> requires considerably more resources when compared with more direct methods of communication such as the <cite><a class="bibref" data-link-type="biblio" href="#bib-fetch" title="Fetch Standard">Fetch API</a></cite> or [<cite><a class="bibref" data-link-type="biblio" href="#bib-websockets" title="WebSockets Standard">WebSockets</a></cite>]. <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-11">Push messages</a> usually have higher latency than direct communications and they can also be subject to restrictions on use. Most <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-7">push services</a> limit the size and quantity of <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-12">push messages</a> that can be sent. </p> </section> <section id="dependencies"><div class="header-wrapper"><h2 id="x2-dependencies"><bdi class="secno">2. </bdi> Dependencies </h2><a class="self-link" href="#dependencies" aria-label="Permalink for Section 2."></a></div> <p> The <dfn id="dfn-web-push-protocol" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">web push protocol</dfn> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8030" title="Generic Event Delivery Using HTTP Push">RFC8030</a></cite>] describes a protocol that enables communication between a <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-13">user agent</a> or <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-6">application server</a> and a <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-8">push service</a>. 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. </p> <p> The <code><dfn id="dfn-content-encoding" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">Content-Encoding</dfn></code> HTTP header, described in Section 3.1.2.2 of [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc7231" title="Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content">RFC7231</a></cite>], indicates the content coding applied to the payload of a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-13">push message</a>. </p> </section> <section id="concepts"><div class="header-wrapper"><h2 id="x3-concepts"><bdi class="secno">3. </bdi> Concepts </h2><a class="self-link" href="#concepts" aria-label="Permalink for Section 3."></a></div> <section id="application-server"><div class="header-wrapper"><h3 id="x3-1-application-server"><bdi class="secno">3.1 </bdi> Application server </h3><a class="self-link" href="#application-server" aria-label="Permalink for Section 3.1"></a></div> <p> The term <dfn data-plurals="application servers" id="dfn-application-server" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">application server</dfn> refers to server-side components of a web application. </p> </section> <section id="push-message"><div class="header-wrapper"><h3 id="x3-2-push-message"><bdi class="secno">3.2 </bdi> Push message </h3><a class="self-link" href="#push-message" aria-label="Permalink for Section 3.2"></a></div> <p> A <dfn data-plurals="push messages" id="dfn-push-message" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">push message</dfn> is data sent to a web application from an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-7">application server</a>. </p> <p> A <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-14">push message</a> is delivered to the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-active-worker">active worker</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-1">push subscription</a> to which the message was submitted. If the service worker is not currently running, the worker is started to enable delivery. </p> </section> <section id="push-subscription"><div class="header-wrapper"><h3 id="x3-3-push-subscription"><bdi class="secno">3.3 </bdi> Push subscription </h3><a class="self-link" href="#push-subscription" aria-label="Permalink for Section 3.3"></a></div> <p> A <dfn data-plurals="push subscriptions" id="dfn-push-subscription" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">push subscription</dfn> is a message delivery context established between the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-14">user agent</a> and the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-9">push service</a> on behalf of a web application. Each <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-2">push subscription</a> is associated with a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> and a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> has at most one <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-3">push subscription</a>. </p> <p> A <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-4">push subscription</a> has an associated <dfn data-plurals="push endpoints" id="dfn-push-endpoint" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">push endpoint</dfn>. It <em class="rfc2119">MUST</em> be the absolute URL exposed by the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-10">push service</a> where the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-8">application server</a> can send <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-15">push messages</a> to. A <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-1">push endpoint</a> <em class="rfc2119">MUST</em> uniquely identify the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-5">push subscription</a>. </p> <p> A <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-6">push subscription</a> <em class="rfc2119">MAY</em> have an associated <dfn id="dfn-subscription-expiration-time" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">subscription expiration time</dfn>. When set, it <em class="rfc2119">MUST</em> be the time, in milliseconds since 00:00:00 UTC on 1 January 1970, at which the subscription will be <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-1">deactivated</a>. The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-15">user agent</a> <em class="rfc2119">SHOULD</em> attempt to <a href="#dfn-refresh" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-refresh-1">refresh</a> the push subscription before the subscription expires. </p> <p> A <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-7">push subscription</a> has internal slots for a P-256 <a href="#dfn-ecdh" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-ecdh-1"><abbr title="elliptic curve Diffie-Hellman">ECDH</abbr></a> key pair and an authentication secret in accordance with [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. These slots <em class="rfc2119">MUST</em> be populated when creating the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-8">push subscription</a>. </p> <p> If the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-16">user agent</a> has to change the keys for any reason, it <em class="rfc2119">MUST</em> <a href="#dfn-fire-the-pushsubscriptionchange-event" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-fire-the-pushsubscriptionchange-event-1">fire the "<code>pushsubscriptionchange</code>" event</a> with the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-9">push subscription</a> as <var>registration</var>, a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-1"><code>PushSubscription</code></a> instance representing the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-10">push subscription</a> having the old keys as <var>oldSubscription</var> and a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-2"><code>PushSubscription</code></a> instance representing the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-11">push subscription</a> having the new keys as <var>newSubscription</var>. </p> <p> To <dfn id="dfn-create-a-push-subscription" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">create a push subscription</dfn>, given an <a data-link-type="idl" data-lt="PushSubscriptionOptionsInit" href="#dom-pushsubscriptionoptionsinit" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-1"><code>PushSubscriptionOptionsInit</code></a> <var data-type="PushSubscriptionOptionsInit">optionsDictionary</var>: </p> <ol class="algorithm"> <li>Let <var data-type="PushSubscription">subscription</var> be a new <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-3"><code>PushSubscription</code></a>. </li> <li>Let <var data-type="PushSubscriptionOptions">options</var> be a newly created <a data-link-type="idl" data-lt="PushSubscriptionOptions" href="#dom-pushsubscriptionoptions" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-1"><code>PushSubscriptionOptions</code></a> object, initializing its attributes with the corresponding members and values of <var data-type="PushSubscriptionOptionsInit">optionsDictionary</var>. </li> <li>Set <var data-type="PushSubscription">subscription</var>'s <a data-link-type="idl" href="#dom-pushsubscription-options" class="internalDFN" id="ref-for-dom-pushsubscription-options-1"><code>options</code></a> attribute to <var data-type="PushSubscriptionOptions">options</var>. </li> <li>Generate a new P-256 <a href="#dfn-ecdh" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-ecdh-2"><abbr title="elliptic curve Diffie-Hellman">ECDH</abbr></a> key pair [<cite><a class="bibref" data-link-type="biblio" href="#bib-ansi-x9-62" title="Public Key Cryptography for the Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA)">ANSI-X9-62</a></cite>]. Store the private key in an internal slot on <var data-type="PushSubscription">subscription</var>; this value <em class="rfc2119">MUST NOT</em> be made available to applications. The public key is also stored in an internal slot and can be retrieved by calling the <a data-link-type="idl" data-lt="getKey()" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-1"><code>getKey</code></a><code>()</code> method of the <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-4"><code>PushSubscription</code></a> with an argument of "<a data-link-type="idl" href="#dom-pushencryptionkeyname-p256dh" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-p256dh-1"><code>p256dh</code></a>". </li> <li>Generate a new authentication secret, which is a sequence of octets as defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. Store the authentication secret in an internal slot on <var data-type="PushSubscription">subscription</var>. This key can be retrieved by calling the <a data-link-type="idl" data-lt="getKey()" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-2"><code>getKey</code></a><code>()</code> method of the <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-5"><code>PushSubscription</code></a> with an argument of "<a data-link-type="idl" href="#dom-pushencryptionkeyname-auth" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-auth-1"><code>auth</code></a>". </li> <li>Request a new <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-12">push subscription</a>. Include the <a data-link-type="idl" href="#dom-pushsubscriptionoptions-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-1"><code>applicationServerKey</code></a> attribute of <var data-type="PushSubscriptionOptions">options</var> when it has been set. Rethrow any <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-exception">exceptions</a>. </li> <li>When the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-13">push subscription</a> request has completed successfully: <ol> <li>Set <var data-type="PushSubscription">subscription</var>'s <a data-link-type="idl" href="#dom-pushsubscription-endpoint" class="internalDFN" id="ref-for-dom-pushsubscription-endpoint-1"><code>endpoint</code></a> attribute to the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-14">push subscription</a>'s <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-2">push endpoint</a>. </li> <li>If provided by the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-15">push subscription</a>, set <var data-type="PushSubscription">subscription</var>'s <a data-link-type="idl" href="#dom-pushsubscription-expirationtime" class="internalDFN" id="ref-for-dom-pushsubscription-expirationtime-1"><code>expirationTime</code></a>. </li> </ol> </li> <li>Return <var data-type="PushSubscription">subscription</var>. </li> </ol> <section id="subscription-refreshes"><div class="header-wrapper"><h4 id="x3-3-1-subscription-refreshes"><bdi class="secno">3.3.1 </bdi> Subscription Refreshes </h4><a class="self-link" href="#subscription-refreshes" aria-label="Permalink for Section 3.3.1"></a></div> <p> A <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-17">user agent</a> or <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-11">push service</a> <em class="rfc2119">MAY</em> choose to <dfn id="dfn-refresh" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">refresh</dfn> a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-16">push subscription</a> at any time, for example because it has reached a certain age. </p> <p> When this happens, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-18">user agent</a> <em class="rfc2119">MUST</em> run the steps to <a href="#dfn-create-a-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-create-a-push-subscription-1">create a push subscription</a> given the <a href="#dom-pushsubscriptionoptions" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushsubscriptionoptions-2"><code>PushSubscriptionOptions</code></a> that were provided for creating the current <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-17">push subscription</a>. The new <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-18">push subscription</a> <em class="rfc2119">MUST</em> have a key pair that's different from the original subscription. </p> <p> When successful, <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-19">user agent</a> then <em class="rfc2119">MUST</em> <a href="#dfn-fire-the-pushsubscriptionchange-event" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-fire-the-pushsubscriptionchange-event-2">fire the "<code>pushsubscriptionchange</code>" event</a> with the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-19">push subscription</a> as <var>registration</var>, a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-6"><code>PushSubscription</code></a> instance representing the initial <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-20">push subscription</a> as <var>oldSubscription</var> and a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-7"><code>PushSubscription</code></a> instance representing the new <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-21">push subscription</a> as <var>newSubscription</var>. </p> <p> To allow for time to propagate changes to <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-9">application servers</a>, a <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-20">user agent</a> <em class="rfc2119">MAY</em> continue to accept messages for an old <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-22">push subscription</a> for a brief time after a refresh. Once messages have been received for a refreshed <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-23">push subscription</a>, any old <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-24">push subscriptions</a> <em class="rfc2119">MUST</em> be <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-2">deactivated</a>. </p> <p> If the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-21">user agent</a> is not able to refresh the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-25">push subscription</a>, it <em class="rfc2119">SHOULD</em> periodically retry the refresh. When the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-26">push subscription</a> can no longer be used, for example because it has expired, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-22">user agent</a> <em class="rfc2119">MUST</em> <a href="#dfn-fire-the-pushsubscriptionchange-event" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-fire-the-pushsubscriptionchange-event-3">fire the "<code>pushsubscriptionchange</code>" event</a> with the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-27">push subscription</a> as <var>registration</var>, a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-8"><code>PushSubscription</code></a> instance representing the deactivating <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-28">push subscription</a> as <var>oldSubscription</var> and <code>null</code> as the <var>newSubscription</var>. </p> </section> <section id="subscription-deactivation"><div class="header-wrapper"><h4 id="x3-3-2-subscription-deactivation"><bdi class="secno">3.3.2 </bdi> Subscription Deactivation </h4><a class="self-link" href="#subscription-deactivation" aria-label="Permalink for Section 3.3.2"></a></div> <p> When a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-29">push subscription</a> is <dfn data-lt="deactivate|deactivated" id="dfn-deactivate" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">deactivated</dfn>, both the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-23">user agent</a> and the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-12">push service</a> <em class="rfc2119">MUST</em> delete any stored copies of its details. Subsequent <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-16">push messages</a> for this <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-30">push subscription</a> <em class="rfc2119">MUST NOT</em> be delivered. </p> <p> A <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-31">push subscription</a> is <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-3">deactivated</a> when its associated <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> is unregistered, though a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-32">push subscription</a> <em class="rfc2119">MAY</em> be <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-4">deactivated</a> earlier. </p> <div class="note" role="note" id="issue-container-generatedID"><div role="heading" class="note-title marker" id="h-note" aria-level="5"><span>Note</span></div><p class=""> A <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-33">push subscription</a> is removed when <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> is cleared. </p></div> </section> </section> <section id="push-service"><div class="header-wrapper"><h3 id="x3-4-push-service"><bdi class="secno">3.4 </bdi> Push service </h3><a class="self-link" href="#push-service" aria-label="Permalink for Section 3.4"></a></div> <p> The term <dfn data-plurals="push services" id="dfn-push-service" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">push service</dfn> refers to a system that allows <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-10">application servers</a> to send <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-17">push messages</a> to a web application. A push service serves the <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-3">push endpoint</a> or <a data-lt="push endpoints" href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-4">endpoints</a> for the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-34">push subscriptions</a> it serves. </p> <p> The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-24">user agent</a> connects to the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-13">push service</a> used to create <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-35">push subscriptions</a>. <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-25">User agents</a> <em class="rfc2119">MAY</em> limit the choice of <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-14">push services</a> 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, specific <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-15">push services</a>. </p> </section> <section id="permission"><div class="header-wrapper"><h3 id="x3-5-permission"><bdi class="secno">3.5 </bdi> Permission </h3><a class="self-link" href="#permission" aria-label="Permalink for Section 3.5"></a></div> <p> The Push API is a <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-powerful-feature">powerful feature</a> identified by the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-name">name</a> <dfn class="permission export" data-dfn-type="permission" data-export="" id="dfn-push" tabindex="0" aria-haspopup="dialog">"push"</dfn>. </p> <p> For integration with the <cite><a data-matched-text="[[[Permissions]]]" href="https://www.w3.org/TR/permissions/">Permissions</a></cite> specification, this specification defines the <a data-link-type="idl" data-lt="PushPermissionDescriptor" href="#dom-pushpermissiondescriptor" class="internalDFN" id="ref-for-dom-pushpermissiondescriptor-1"><code>PushPermissionDescriptor</code></a> <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-permission-descriptor-type">permission descriptor type</a>. </p> <pre class="idl def" id="webidl-1117437819"><span class="idlHeader"><a class="self-link" href="#webidl-1117437819">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-pushpermissiondescriptor" data-title="PushPermissionDescriptor">dictionary <dfn data-export="" data-dfn-type="dictionary" id="dom-pushpermissiondescriptor" data-idl="dictionary" data-title="PushPermissionDescriptor" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>PushPermissionDescriptor</code></dfn> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://www.w3.org/TR/permissions/#dom-permissiondescriptor">PermissionDescriptor</a></span> {<span data-idl="" class="idlMember" id="idl-def-pushpermissiondescriptor-uservisibleonly" data-title="userVisibleOnly" data-dfn-for="PushPermissionDescriptor"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushpermissiondescriptor-uservisibleonly" id="ref-for-dom-pushpermissiondescriptor-uservisibleonly-1"><code>userVisibleOnly</code></a> = false;</span> };</span></code></pre> <p data-dfn-for="PushPermissionDescriptor"> The <dfn data-export="" data-dfn-type="dict-member" id="dom-pushpermissiondescriptor-uservisibleonly" data-idl="field" data-title="userVisibleOnly" data-dfn-for="PushPermissionDescriptor" data-type="boolean" tabindex="0" aria-haspopup="dialog"><code>userVisibleOnly</code></dfn> has the same semantics as <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-uservisibleonly" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-1"><code>userVisibleOnly</code></a>. </p> <p> <code>{name: "push", userVisibleOnly: false}</code> is <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-stronger-than">stronger than</a> <code>{name: "push", userVisibleOnly: true}</code>. </p> </section> </section> <section id="security-and-privacy-considerations"><div class="header-wrapper"><h2 id="x4-security-and-privacy-considerations"><bdi class="secno">4. </bdi> Security and privacy considerations </h2><a class="self-link" href="#security-and-privacy-considerations" aria-label="Permalink for Section 4."></a></div> <p> The contents of a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-18">push message</a> are encrypted [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. However, the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-16">push service</a> is still exposed to the metadata of messages sent by an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-11">application server</a> to a <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-26">user agent</a> over a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-36">push subscription</a>. This includes the timing, frequency and size of messages. Other than changing <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-17">push services</a>, which user agents may disallow, the only known mitigation is to increase the apparent message size by padding. </p> <p> There is no guarantee that a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-19">push message</a> was sent by an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-12">application server</a> having the same origin as the web application. The <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-13">application server</a> is able to share the details necessary to use a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-37">push subscription</a> with a third party at its own discretion. </p> <p> 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 the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-14">application server</a>'s communication with the user. </p> <p> <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-27">User agents</a> <em class="rfc2119">MUST NOT</em> provide Push API access to web applications without the <a data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-express-permission">express permission</a> of the user. <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-28">User agents</a> <em class="rfc2119">MUST</em> acquire consent for permission through a user interface for each call to the <code>subscribe()</code> method, unless a previous permission grant has been persisted, or a prearranged trust relationship applies. Permissions that are preserved beyond the current browsing session <em class="rfc2119">MUST</em> be revocable. </p> <p> The Push API may have to wake up the Service Worker associated with the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> in order to run the developer-provided event handlers. This can cause resource usage, such as network traffic, that the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-29">user agent</a> <em class="rfc2119">SHOULD</em> attribute to the web application that created the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-38">push subscription</a>. </p> <p> The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-30">user agent</a> <em class="rfc2119">MAY</em> consider the <a href="#dom-pushsubscriptionoptions" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushsubscriptionoptions-3"><code>PushSubscriptionOptions</code></a> when acquiring permission or determining the permission status. </p> <p> When a permission is revoked, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-31">user agent</a> <em class="rfc2119">MAY</em> <a href="#dfn-fire-the-pushsubscriptionchange-event" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-fire-the-pushsubscriptionchange-event-4">fire the "<code>pushsubscriptionchange</code>" event</a> for subscriptions created with that permission, with the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-39">push subscription</a> as <var>registration</var>, a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-9"><code>PushSubscription</code></a> instance representing the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-40">push subscription</a> as <var>oldSubscription</var>, and <code>null</code> as <var>newSubscription</var>. The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-32">user agent</a> <em class="rfc2119">MUST</em> <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-5">deactivate</a> the affected subscriptions in parallel. </p> <p> When a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> is unregistered, any associated <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-41">push subscription</a> <em class="rfc2119">MUST</em> be <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-6">deactivated</a>. </p> <p> The <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-5">push endpoint</a> <em class="rfc2119">MUST NOT</em> expose information about the user to be derived by actors other than the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-18">push service</a>, such as the user's device, identity or location. See the Privacy Considerations in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8030" title="Generic Event Delivery Using HTTP Push">RFC8030</a></cite>] for the exact requirements. </p> <p> The <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-6">push endpoint</a> of a <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-7">deactivated</a> <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-42">push subscription</a> <em class="rfc2119">MUST NOT</em> be reused for a new <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-43">push subscription</a>. This prevents the creation of a persistent identifier that the user cannot remove. This also prevents reuse of the details of one <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-44">push subscription</a> to send <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-20">push messages</a> to another <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-45">push subscription</a>. </p> <p> <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-33">User agents</a> <em class="rfc2119">MUST</em> implement the Push API to only be available in a <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#secure-context">secure context</a>. 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. </p> </section> <section class="informative" id="pushframework"><div class="header-wrapper"><h2 id="x5-push-framework"><bdi class="secno">5. </bdi> Push Framework </h2><a class="self-link" href="#pushframework" aria-label="Permalink for Section 5."></a></div><p><em>This section is non-normative.</em></p> <p> A <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-21">push message</a> is sent from an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-15">application server</a> to a web application as follows: </p> <ul> <li>the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-16">application server</a> requests that the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-19">push service</a> deliver a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-22">push message</a> using the [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8030" title="Generic Event Delivery Using HTTP Push">RFC8030</a></cite>]. This request uses the <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-7">push endpoint</a> included in the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-46">push subscription</a>; </li> <li>the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-20">push service</a> delivers the message to a specific <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-34">user agent</a>, identifying the <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-8">push endpoint</a> in the message; </li> <li>the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-35">user agent</a> identifies the intended <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker">Service Worker</a> and activates it as necessary, and delivers the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-23">push message</a> to the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker">Service Worker</a>. </li> </ul> <p> This overall framework allows <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-17">application servers</a> to activate a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker">Service Worker</a> in response to events at the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-18">application server</a>. Information about those events can be included in the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-24">push message</a>, which allows the web application to react appropriately to those events, potentially without needing to initiate network requests. </p> <p> The following code and diagram illustrate a hypothetical use of the push API. </p> <section class="informative" id="example"><div class="header-wrapper"><h3 id="x5-1-example"><bdi class="secno">5.1 </bdi> Example </h3><a class="self-link" href="#example" aria-label="Permalink for Section 5.1"></a></div><p><em>This section is non-normative.</em></p> <div class="example" id="example-1"> <div class="marker"> <a class="self-link" href="#example-1">Example<bdi> 1</bdi></a> </div> <pre aria-busy="false"><code class="hljs javascript"><span class="hljs-comment">// https://example.com/serviceworker.js</span> <span class="hljs-built_in">this</span>.onpush = <span class="hljs-function"><span class="hljs-params">event</span> =&gt;</span> { <span class="hljs-built_in">console</span>.log(event.data); <span class="hljs-comment">// From here we can write the data to IndexedDB, send it to any open</span> <span class="hljs-comment">// windows, display a notification, etc.</span> } <span class="hljs-comment">// https://example.com/webapp.js</span> <span class="hljs-comment">// inside an async function...</span> <span class="hljs-keyword">try</span> { <span class="hljs-keyword">const</span> serviceWorkerRegistration = <span class="hljs-keyword">await</span> navigator.serviceWorker.register( <span class="hljs-string">"serviceworker.js"</span> ); <span class="hljs-keyword">const</span> pushSubscription = <span class="hljs-keyword">await</span> serviceWorkerRegistration.pushManager.subscribe(); <span class="hljs-comment">// The push subscription details needed by the application</span> <span class="hljs-comment">// server are now available, and can be sent to it using,</span> <span class="hljs-comment">// for example, an XMLHttpRequest.</span> <span class="hljs-built_in">console</span>.log(pushSubscription.endpoint); <span class="hljs-built_in">console</span>.log(pushSubscription.getKey(<span class="hljs-string">"p256dh"</span>)); <span class="hljs-built_in">console</span>.log(pushSubscription.getKey(<span class="hljs-string">"auth"</span>)); } <span class="hljs-keyword">catch</span> (err) { <span class="hljs-comment">// In a production environment it might make sense to</span> <span class="hljs-comment">// also report information about errors back to the</span> <span class="hljs-comment">// application server.</span> <span class="hljs-built_in">console</span>.log(error); }</code></pre> </div> </section> <section class="informative" id="sequence-diagram"><div class="header-wrapper"><h3 id="x5-2-sequence-diagram"><bdi class="secno">5.2 </bdi> Sequence diagram </h3><a class="self-link" href="#sequence-diagram" aria-label="Permalink for Section 5.2"></a></div><p><em>This section is non-normative.</em></p> <figure id="fig-example-flow-of-events-for-subscription-push-message-delivery-and-unsubscription"> <a href="images/sequence_diagram.png"><img src="images/sequence_diagram.png" width="795" height="870" alt="Example flow of events for subscription, push message delivery, and unsubscription"></a> <figcaption><a class="self-link" href="#fig-example-flow-of-events-for-subscription-push-message-delivery-and-unsubscription">Figure <bdi class="figno">1</bdi></a> <span class="fig-title"> Example flow of events for subscription, push message delivery, and unsubscription </span></figcaption> </figure> </section> <section id="push-service-use"><div class="header-wrapper"><h3 id="x5-3-push-service-use"><bdi class="secno">5.3 </bdi> Push service use </h3><a class="self-link" href="#push-service-use" aria-label="Permalink for Section 5.3"></a></div> <p> The fields included in the <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-10"><code>PushSubscription</code></a> is all the information needed for an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-19">application server</a> to send a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-25">push message</a>. Push services that are compatible with the Push API provide a <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-9">push endpoint</a> that conforms to the <a href="#dfn-web-push-protocol" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-web-push-protocol-2">web push protocol</a>. These parameters and attributes include: </p> <ul> <li>The <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-10">push endpoint</a> of a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-11"><code>PushSubscription</code></a> is a URL that allows an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-20">application server</a> to request delivery of a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-26">push message</a> to a web application. </li> <li>The <a data-link-type="idl" data-lt="getKey()" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-3"><code>getKey</code></a><code>()</code> method on a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-12"><code>PushSubscription</code></a> is used to retrieve keying material used to encrypt and authenticate <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-27">push messages</a>. Each invocation of the function returns a new <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> that contains the value of the corresponding key, or <code>null</code> if the identified key doesn't exist. Passing a value of "<a data-link-type="idl" href="#dom-pushencryptionkeyname-p256dh" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-p256dh-2"><code>p256dh</code></a>" retrieves a <dfn data-abbr="ECDH" data-lt="ECDH|elliptic curve Diffie-Hellman" id="dfn-ecdh" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">elliptic curve Diffie-Hellman</dfn> (<abbr title="elliptic curve Diffie-Hellman">ECDH</abbr>) public key associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-47">push subscription</a>. Passing a value of <code>auth</code> returns an authentication secret that an application server uses in authentication of its messages. These keys are used by the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-21">application server</a> to encrypt and authenticate messages for the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-48">push subscription</a>, as described in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. </li> </ul> </section> </section> <section data-dfn-for="ServiceWorkerRegistration" id="extensions-to-the-serviceworkerregistration-interface"><div class="header-wrapper"><h2 id="x6-extensions-to-the-serviceworkerregistration-interface"><bdi class="secno">6. </bdi> Extensions to the <code>ServiceWorkerRegistration</code> Interface </h2><a class="self-link" href="#extensions-to-the-serviceworkerregistration-interface" aria-label="Permalink for Section 6."></a></div> <p> The Service Worker specification defines a <a data-link-type="idl" data-lt="ServiceWorkerRegistration" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerregistration"><code>ServiceWorkerRegistration</code></a> interface [<cite><a class="bibref" data-link-type="biblio" href="#bib-service-workers" title="Service Workers">SERVICE-WORKERS</a></cite>], which this specification extends. </p> <pre class="idl def" data-cite="WEBIDL service-workers" id="webidl-27231878"><span class="idlHeader"><a class="self-link" href="#webidl-27231878">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-serviceworkerregistration-partial-1" data-title="ServiceWorkerRegistration">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="ServiceWorkerRegistration" class="idlID" data-dfn-for="ServiceWorkerRegistration" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerregistration">ServiceWorkerRegistration</a> {<span data-idl="" class="idlAttribute" id="idl-def-serviceworkerregistration-pushmanager" data-title="pushManager" data-dfn-for="ServiceWorkerRegistration"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushmanager" class="internalDFN" id="ref-for-dom-pushmanager-1"><code>PushManager</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-serviceworkerregistration-pushmanager" id="ref-for-dom-serviceworkerregistration-pushmanager-1"><code>pushManager</code></a>;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-serviceworkerregistration-pushmanager" data-idl="attribute" data-title="pushManager" data-dfn-for="ServiceWorkerRegistration" data-type="PushManager" data-lt="pushManager" data-local-lt="ServiceWorkerRegistration.pushManager" tabindex="0" aria-haspopup="dialog"><code>pushManager</code></dfn> attribute exposes a <a data-link-type="idl" data-lt="PushManager" href="#dom-pushmanager" class="internalDFN" id="ref-for-dom-pushmanager-2"><code>PushManager</code></a>, which has an associated <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> represented by the <a data-link-type="idl" data-lt="ServiceWorkerRegistration" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerregistration"><code>ServiceWorkerRegistration</code></a> on which the attribute is exposed. </p> </section> <section data-dfn-for="PushManager" id="pushmanager-interface"><div class="header-wrapper"><h2 id="x7-pushmanager-interface"><bdi class="secno">7. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-pushmanager" data-idl="interface" data-title="PushManager" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushManager</code></dfn> interface </h2><a class="self-link" href="#pushmanager-interface" aria-label="Permalink for Section 7."></a></div> <p> The <a data-link-type="idl" data-lt="PushManager" href="#dom-pushmanager" class="internalDFN" id="ref-for-dom-pushmanager-3"><code>PushManager</code></a> interface defines the operations to access <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-21">push services</a>. </p> <pre class="idl def" id="webidl-1816674501"><span class="idlHeader"><a class="self-link" href="#webidl-1816674501">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-pushmanager" data-title="PushManager">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushmanager" id="ref-for-dom-pushmanager-4"><code>PushManager</code></a> {<span data-idl="" class="idlAttribute" id="idl-def-pushmanager-supportedcontentencodings" data-title="supportedContentEncodings" data-dfn-for="PushManager"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] static readonly attribute<span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-frozen-array">FrozenArray</a>&lt;<a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>&gt;</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushmanager-supportedcontentencodings" id="ref-for-dom-pushmanager-supportedcontentencodings-1"><code>supportedContentEncodings</code></a>;</span><span data-idl="" class="idlMethod" id="idl-def-pushmanager-subscribe-options" data-title="subscribe" data-dfn-for="PushManager"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-13"><code>PushSubscription</code></a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmanager-subscribe" id="ref-for-dom-pushmanager-subscribe-1"><code>subscribe</code></a>(optional<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-2"><code>PushSubscriptionOptionsInit</code></a></span> <span class="idlParamName">options</span> = {});</span><span data-idl="" class="idlMethod" id="idl-def-pushmanager-getsubscription" data-title="getSubscription" data-dfn-for="PushManager"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-14"><code>PushSubscription</code></a>?&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmanager-getsubscription" id="ref-for-dom-pushmanager-getsubscription-1"><code>getSubscription</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-pushmanager-permissionstate-options" data-title="permissionState" data-dfn-for="PushManager"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" data-type="enum" href="https://www.w3.org/TR/permissions/#dom-permissionstate">PermissionState</a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmanager-permissionstate" id="ref-for-dom-pushmanager-permissionstate-1"><code>permissionState</code></a>(optional<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-3"><code>PushSubscriptionOptionsInit</code></a></span> <span class="idlParamName">options</span> = {});</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-pushmanager-supportedcontentencodings" data-idl="attribute" data-title="supportedContentEncodings" data-dfn-for="PushManager" data-type="FrozenArray" data-lt="supportedContentEncodings" data-local-lt="PushManager.supportedContentEncodings" tabindex="0" aria-haspopup="dialog"><code>supportedContentEncodings</code></dfn> attribute exposes the sequence of supported content codings that can be used to encrypt the payload of a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-28">push message</a>. A content coding is indicated using the <a href="#dfn-content-encoding" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-content-encoding-1"><code>Content-Encoding</code></a> header field when requesting the sending of a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-29">push message</a> from the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-22">push service</a>. </p> <p> <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-36">User agents</a> <em class="rfc2119">MUST</em> support the <code>aes128gcm</code> content coding defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>], and <em class="rfc2119">MAY</em> support content codings defined in previous versions of the draft for compatibility reasons. </p> <section id="subscribe-method"><div class="header-wrapper"><h3 id="x7-1-subscribe-method"><bdi class="secno">7.1 </bdi> <code>subscribe()</code> method </h3><a class="self-link" href="#subscribe-method" aria-label="Permalink for Section 7.1"></a></div> <p> The <dfn data-export="" data-dfn-type="method" id="dom-pushmanager-subscribe" data-idl="operation" data-title="subscribe()" data-dfn-for="PushManager" data-type="Promise" data-lt="subscribe()|subscribe(options)" data-local-lt="PushManager.subscribe|PushManager.subscribe()|subscribe" tabindex="0" aria-haspopup="dialog"><code>subscribe()</code></dfn> method when invoked <em class="rfc2119">MUST</em> run the following steps: </p> <ol class="algorithm"> <li>Let <var>promise</var> be <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise">a new promise</a>. </li> <li>Let <var>global</var> be <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>' <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global">relevant global object</a>. </li> <li>Return <var>promise</var> and continue <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>. <div class="note" role="note" id="issue-container-generatedID-0"><div role="heading" class="note-title marker" id="h-note-0" aria-level="3"><span>Note</span><span class="issue-label">: Validation order can vary across user agents</span></div><aside class=""> <p> Because of implementation-specific reasons, user agents are known to do some of the following checks in different order (e.g., some check if <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-uservisibleonly" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-2"><code>userVisibleOnly</code></a> is allowed after validating the <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-1"><code>applicationServerKey</code></a>, and vice versa). However, we don't believe this affects interoperability of implementations or web applications. </p> </aside></div> </li> <li>If the <var>options</var> argument has a <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-uservisibleonly" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-3"><code>userVisibleOnly</code></a> value set to <code>false</code> and the user agent requires it to be <code>true</code>, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#notallowederror"><code>NotAllowedError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> </li> <li>If the <var>options</var> argument does not include a non-null value for the <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-2"><code>applicationServerKey</code></a> member, and the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-23">push service</a> requires one to be given, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with a "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#notsupportederror"><code>NotSupportedError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a>. </li> <li>If the <var>options</var> argument includes a non-null value for the <a data-link-type="idl" href="#dom-pushsubscriptionoptions-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-2"><code>applicationServerKey</code></a> attribute, run the following sub-steps: <ol> <li>If <var>options</var>'s <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-3"><code>applicationServerKey</code></a> is a <a data-link-type="idl" data-lt="DOMString" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><code>DOMString</code></a>, set its value to an <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> containing the sequence of octets that result from decoding <var>options</var>'s <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-4"><code>applicationServerKey</code></a> using the base64url encoding [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc7515" title="JSON Web Signature (JWS)">RFC7515</a></cite>]. </li> <li>If decoding fails, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with an "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidcharactererror"><code>InvalidCharacterError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> and terminate these steps. </li> <li>Ensure that <var>options</var>'s <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-5"><code>applicationServerKey</code></a> describes a valid point on the P-256 curve. If its value is invalid, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with an "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidaccesserror"><code>InvalidAccessError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> and terminate these steps. </li> </ol> </li> <li>Let <var data-type="ServiceWorkerRegistration">registration</var> be <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s associated <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a>. </li> <li>If <var data-type="ServiceWorkerRegistration">registration</var>'s <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-active-worker">active worker</a> is null, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with an "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> and terminate these steps. </li> <li>Let <var>permission</var> be <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-request-permission-to-use">request permission to use</a> "push". </li> <li>If <var>permission</var> is "<a data-link-type="idl" data-type="enum-value" href="https://www.w3.org/TR/permissions/#dom-permissionstate-denied"><code>denied</code></a>", <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#user-interaction-task-source">user interaction task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with a "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#notallowederror"><code>NotAllowedError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> and terminate these steps. </li> <li>If <var data-type="ServiceWorkerRegistration">registration</var> has a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-49">push subscription</a>: <ol> <li>Let <var>subscription</var> be the result of obtaining <var data-type="ServiceWorkerRegistration">registration</var>'s <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-50">push subscription</a>. If there is an error, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with an "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#aborterror"><code>AbortError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> and terminate these steps. </li> <li>Compare the <var>options</var> argument with the <code>options</code> attribute of <var>subscription</var>. The contents of <a data-link-type="idl" data-lt="BufferSource" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource"><code>BufferSource</code></a> values are compared for equality rather than <a data-link-type="dfn|abstract-op" data-lt="reference record" data-type="dfn" href="https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-reference-record-specification-type">reference</a>. </li> <li>If any attribute on <var>options</var> contains a different value to that stored for <var>subscription</var>, then <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with an "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#invalidstateerror"><code>InvalidStateError</code></a>" <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> and terminate these steps. </li> <li>When the request has been completed, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#resolve">resolve</a> <var>promise</var> with <var>subscription</var> and terminate these steps. </li> </ol> </li> <li>Let <var>subscription</var> be the result of trying to <a data-link-type="dfn|abstract-op" href="#dfn-create-a-push-subscription" class="internalDFN" id="ref-for-dfn-create-a-push-subscription-2">create a push subscription</a> with <var>options</var>. If creating the subscription <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw">throws</a> an <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-exception">exception</a>, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#reject">reject</a> <var>promise</var> with a that <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-exception">exception</a> and terminate these these steps. </li> <li>Otherwise, <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task">queue a global task</a> on the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#networking-task-source">networking task source</a> using <var>global</var> to <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#resolve">resolve</a> <var>promise</var> with a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-15"><code>PushSubscription</code></a> providing the details of the new <var>subscription</var>. </li> </ol> <p> The <dfn data-dfn-for="PushManager" data-export="" data-dfn-type="method" id="dom-pushmanager-getsubscription" data-idl="operation" data-title="getSubscription" data-type="Promise" data-lt="getSubscription()" data-local-lt="PushManager.getSubscription|PushManager.getSubscription()|getSubscription" tabindex="0" aria-haspopup="dialog"><code>getSubscription</code></dfn> method when invoked <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li>Let <var>promise</var> be <a data-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise">a new promise</a>. </li> <li>Return <var>promise</var> and continue the following steps asynchronously. </li> <li>If the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker">Service Worker</a> is not subscribed, resolve <var>promise</var> with null. </li> <li>Retrieve the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-51">push subscription</a> associated with the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker">Service Worker</a>. </li> <li>If there is an error, reject <var>promise</var> with a <a data-link-type="idl" data-lt="DOMException" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMException"><code>DOMException</code></a> whose name is "<a data-link-type="idl" data-type="exception" href="https://webidl.spec.whatwg.org/#aborterror"><code>AbortError</code></a>" and terminate these steps. </li> <li>When the request has been completed, resolve <var>promise</var> with a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-16"><code>PushSubscription</code></a> providing the details of the retrieved <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-52">push subscription</a>. </li> </ol> <p> The <dfn data-dfn-for="PushManager" data-export="" data-dfn-type="method" id="dom-pushmanager-permissionstate" data-idl="operation" data-title="permissionState()" data-type="Promise" data-lt="permissionState()|permissionState(options)" data-local-lt="PushManager.permissionState|PushManager.permissionState()|permissionState" tabindex="0" aria-haspopup="dialog"><code>permissionState()</code></dfn> method when invoked <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li>Let <var>promise</var> be <a data-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise">a new promise</a>. </li> <li>Return <var>promise</var> and continue the following steps asynchronously. </li> <li>Let <var>descriptor</var> be a new <a data-link-type="idl" data-lt="PermissionDescriptor" data-type="dictionary" href="https://www.w3.org/TR/permissions/#dom-permissiondescriptor"><code>PermissionDescriptor</code></a> with the <a data-link-type="idl" data-type="dict-member" href="https://www.w3.org/TR/permissions/#dom-permissiondescriptor-name"><code>name</code></a> initialized to "push". </li> <li>let <var>state</var> be the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-permission-state">permission state</a> of <var>descriptor</var> and the result. </li> <li>Resolve <var>promise</var> with <var>state</var>. </li> </ol> <p> 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. </p> <p> If there is a need to ask for permission, it needs to be done by invoking the <a data-link-type="idl" data-lt="subscribe()" href="#dom-pushmanager-subscribe" class="internalDFN" id="ref-for-dom-pushmanager-subscribe-2"><code>subscribe</code></a><code>()</code> method. </p> </section><section data-dfn-for="PushSubscriptionOptions" id="pushsubscriptionoptions-interface"><div class="header-wrapper"><h3 id="x7-2-pushsubscriptionoptions-interface"><bdi class="secno">7.2 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-pushsubscriptionoptions" data-idl="interface" data-title="PushSubscriptionOptions" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushSubscriptionOptions</code></dfn> Interface </h3><a class="self-link" href="#pushsubscriptionoptions-interface" aria-label="Permalink for Section 7.2"></a></div> <pre class="idl def" id="webidl-1484551711"><span class="idlHeader"><a class="self-link" href="#webidl-1484551711">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-pushsubscriptionoptions" data-title="PushSubscriptionOptions">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushsubscriptionoptions" id="ref-for-dom-pushsubscriptionoptions-4"><code>PushSubscriptionOptions</code></a> {<span data-idl="" class="idlAttribute" id="idl-def-pushsubscriptionoptions-uservisibleonly" data-title="userVisibleOnly" data-dfn-for="PushSubscriptionOptions"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionoptions-uservisibleonly" id="ref-for-dom-pushsubscriptionoptions-uservisibleonly-1"><code>userVisibleOnly</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-pushsubscriptionoptions-applicationserverkey" data-title="applicationServerKey" data-dfn-for="PushSubscriptionOptions"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer">ArrayBuffer</a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionoptions-applicationserverkey" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-3"><code>applicationServerKey</code></a>;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscriptionoptions-uservisibleonly" data-idl="attribute" data-title="userVisibleOnly" data-dfn-for="PushSubscriptionOptions" data-type="boolean" data-lt="userVisibleOnly" data-local-lt="PushSubscriptionOptions.userVisibleOnly" tabindex="0" aria-haspopup="dialog"><code>userVisibleOnly</code></dfn> attribute, when getting, returns the value it was initialized with. </p> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscriptionoptions-applicationserverkey" data-idl="attribute" data-title="applicationServerKey" data-dfn-for="PushSubscriptionOptions" data-type="ArrayBuffer" data-lt="applicationServerKey" data-local-lt="PushSubscriptionOptions.applicationServerKey" tabindex="0" aria-haspopup="dialog"><code>applicationServerKey</code></dfn> attribute, when getting, returns the value it was initialized with. </p> <p> If present, the value of <a data-link-type="idl" href="#dom-pushsubscriptionoptions-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-4"><code>applicationServerKey</code></a> <em class="rfc2119">MUST</em> include a point on the P-256 elliptic curve [<cite><a class="bibref" data-link-type="biblio" href="#bib-dss" title="FIPS PUB 186-5: Digital Signature Standard (DSS)">DSS</a></cite>], encoded in the uncompressed form described in [<cite><a class="bibref" data-link-type="biblio" href="#bib-ansi-x9-62" title="Public Key Cryptography for the Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA)">ANSI-X9-62</a></cite>] Annex A (that is, 65 octets, starting with an 0x04 octet). When provided as a <a data-link-type="idl" data-lt="DOMString" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><code>DOMString</code></a>, the value <em class="rfc2119">MUST</em> be encoded using the base64url encoding [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc7515" title="JSON Web Signature (JWS)">RFC7515</a></cite>]. </p> <p> User agents <em class="rfc2119">MAY</em> reject a subscription attempt when <a data-link-type="idl" href="#dom-pushsubscriptionoptions-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-5"><code>applicationServerKey</code></a> is not present and the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-24">push service</a> requires one for operational reasons. </p> <p> The <a data-link-type="idl" href="#dom-pushsubscriptionoptions-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-6"><code>applicationServerKey</code></a> <em class="rfc2119">MUST</em> be a different value to the one used for message encryption [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. </p> </section> <section data-dfn-for="PushSubscriptionOptionsInit" id="pushsubscriptionoptionsinit-dictionary"><div class="header-wrapper"><h3 id="x7-3-pushsubscriptionoptionsinit-dictionary"><bdi class="secno">7.3 </bdi> <dfn data-export="" data-dfn-type="dictionary" id="dom-pushsubscriptionoptionsinit" data-idl="dictionary" data-title="PushSubscriptionOptionsInit" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushSubscriptionOptionsInit</code></dfn> dictionary </h3><a class="self-link" href="#pushsubscriptionoptionsinit-dictionary" aria-label="Permalink for Section 7.3"></a></div> <pre class="idl def" id="webidl-975599346"><span class="idlHeader"><a class="self-link" href="#webidl-975599346">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-pushsubscriptionoptionsinit" data-title="PushSubscriptionOptionsInit">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pushsubscriptionoptionsinit" id="ref-for-dom-pushsubscriptionoptionsinit-4"><code>PushSubscriptionOptionsInit</code></a> {<span data-idl="" class="idlMember" id="idl-def-pushsubscriptionoptionsinit-uservisibleonly" data-title="userVisibleOnly" data-dfn-for="PushSubscriptionOptionsInit"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionoptionsinit-uservisibleonly" id="ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-4"><code>userVisibleOnly</code></a> = false;</span><span data-idl="" class="idlMember" id="idl-def-pushsubscriptionoptionsinit-applicationserverkey" data-title="applicationServerKey" data-dfn-for="PushSubscriptionOptionsInit"><span class="idlType"> (<a data-link-type="idl" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource">BufferSource</a> or <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>)?</span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-6"><code>applicationServerKey</code></a> = null;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionoptionsinit-uservisibleonly" data-idl="field" data-title="userVisibleOnly" data-dfn-for="PushSubscriptionOptionsInit" data-type="boolean" tabindex="0" aria-haspopup="dialog"><code>userVisibleOnly</code></dfn> member, when set to <code>true</code>, indicates that the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-53">push subscription</a> will only be used for <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-30">push messages</a> whose effect is made visible to the user, for example by displaying a Web Notification. [<cite><a class="bibref" data-link-type="biblio" href="#bib-notifications" title="Notifications API Standard">NOTIFICATIONS</a></cite>] </p> <p> A <a href="#dom-pushsubscriptionoptionsinit" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushsubscriptionoptionsinit-5"><code>PushSubscriptionOptionsInit</code></a> represents additional options associated with a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-54">push subscription</a>. The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-37">user agent</a> <em class="rfc2119">MAY</em> consider these options when requesting <a data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-express-permission">express permission</a> from the user. When an option is considered, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-38">user agent</a> <em class="rfc2119">SHOULD</em> enforce it on incoming <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-31">push messages</a>. </p> <p> These options are optional, and <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-39">user agents</a> <em class="rfc2119">MAY</em> choose to support only a subset of them. A <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-40">user agent</a> <em class="rfc2119">MUST NOT</em> expose options that it does not support. </p> <p> Once set, options for a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-55">push subscription</a> cannot change. A pre-existing <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-56">push subscription</a> can be unsubscribed, via <a data-link-type="idl" href="#dom-pushsubscription-unsubscribe" class="internalDFN" id="ref-for-dom-pushsubscription-unsubscribe-1"><code>unsubscribe</code></a>, to create a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-57">push subscription</a> with new options. </p> <p> The <dfn data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionoptionsinit-applicationserverkey" data-idl="field" data-title="applicationServerKey" data-dfn-for="PushSubscriptionOptionsInit" data-type="BufferSource|DOMString" tabindex="0" aria-haspopup="dialog"><code>applicationServerKey</code></dfn> member is used by the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-41">user agent</a> when establishing a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-58">push subscription</a> with a <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-25">push service</a>. The <a data-link-type="idl" href="#dom-pushsubscriptionoptions-applicationserverkey" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-7"><code>applicationServerKey</code></a> option includes an elliptic curve public key for an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-22">application server</a>. This is the key that the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-23">application server</a> will use to authenticate itself when sending <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-32">push messages</a> to this <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-59">push subscription</a> as defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8292" title="Voluntary Application Server Identification (VAPID) for Web Push">RFC8292</a></cite>]; the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-26">push service</a> will reject any <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-33">push message</a> unless the corresponding private key is used to generate an authentication token. </p> </section> </section> <section data-dfn-for="PushSubscription" id="pushsubscription-interface"><div class="header-wrapper"><h2 id="x8-pushsubscription-interface"><bdi class="secno">8. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-pushsubscription" data-idl="interface" data-title="PushSubscription" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushSubscription</code></dfn> interface </h2><a class="self-link" href="#pushsubscription-interface" aria-label="Permalink for Section 8."></a></div> <p> A <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-17"><code>PushSubscription</code></a> object represents a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-60">push subscription</a>. </p> <pre class="idl def" id="webidl-1348261679"><span class="idlHeader"><a class="self-link" href="#webidl-1348261679">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-pushsubscription" data-title="PushSubscription">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushsubscription" id="ref-for-dom-pushsubscription-18"><code>PushSubscription</code></a> {<span data-idl="" class="idlAttribute" id="idl-def-pushsubscription-endpoint" data-title="endpoint" data-dfn-for="PushSubscription"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a></span> <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscription-endpoint" data-idl="attribute" data-title="endpoint" data-dfn-for="PushSubscription" data-type="USVString" data-lt="endpoint" data-local-lt="PushSubscription.endpoint" class="idlName" tabindex="0" aria-haspopup="dialog"><code>endpoint</code></dfn>;</span><span data-idl="" class="idlAttribute" id="idl-def-pushsubscription-expirationtime" data-title="expirationTime" data-dfn-for="PushSubscription"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://www.w3.org/TR/hr-time-3/#dom-epochtimestamp">EpochTimeStamp</a>?</span> <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscription-expirationtime" data-idl="attribute" data-title="expirationTime" data-dfn-for="PushSubscription" data-type="EpochTimeStamp" data-lt="expirationTime" data-local-lt="PushSubscription.expirationTime" class="idlName" tabindex="0" aria-haspopup="dialog"><code>expirationTime</code></dfn>;</span><span data-idl="" class="idlAttribute" id="idl-def-pushsubscription-options" data-title="options" data-dfn-for="PushSubscription"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionoptions" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-5"><code>PushSubscriptionOptions</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscription-options" id="ref-for-dom-pushsubscription-options-2"><code>options</code></a>;</span><span data-idl="" class="idlMethod" id="idl-def-pushsubscription-getkey-name" data-title="getKey" data-dfn-for="PushSubscription"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer">ArrayBuffer</a>?</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushsubscription-getkey" id="ref-for-dom-pushsubscription-getkey-4"><code>getKey</code></a>(<span class="idlType"><a data-link-type="idl" href="#dom-pushencryptionkeyname" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-1"><code>PushEncryptionKeyName</code></a></span> <span class="idlParamName">name</span>);</span><span data-idl="" class="idlMethod" id="idl-def-pushsubscription-unsubscribe" data-title="unsubscribe" data-dfn-for="PushSubscription"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushsubscription-unsubscribe" id="ref-for-dom-pushsubscription-unsubscribe-2"><code>unsubscribe</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-pushsubscription-tojson" data-title="toJSON" data-dfn-for="PushSubscription"><span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionjson" class="internalDFN" id="ref-for-dom-pushsubscriptionjson-1"><code>PushSubscriptionJSON</code></a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushsubscription-tojson" id="ref-for-dom-pushsubscription-tojson-1"><code>toJSON</code></a>();</span> };</span><span data-idl="" class="idlDictionary" id="idl-def-pushsubscriptionjson" data-title="PushSubscriptionJSON"> dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pushsubscriptionjson" id="ref-for-dom-pushsubscriptionjson-2"><code>PushSubscriptionJSON</code></a> {<span data-idl="" class="idlMember" id="idl-def-pushsubscriptionjson-endpoint" data-title="endpoint" data-dfn-for="PushSubscriptionJSON"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a></span> <dfn data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionjson-endpoint" data-idl="field" data-title="endpoint" data-dfn-for="PushSubscriptionJSON" data-type="USVString" class="idlName" tabindex="0" aria-haspopup="dialog"><code>endpoint</code></dfn>;</span><span data-idl="" class="idlMember" id="idl-def-pushsubscriptionjson-expirationtime" data-title="expirationTime" data-dfn-for="PushSubscriptionJSON"><span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://www.w3.org/TR/hr-time-3/#dom-epochtimestamp">EpochTimeStamp</a>?</span> <dfn data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionjson-expirationtime" data-idl="field" data-title="expirationTime" data-dfn-for="PushSubscriptionJSON" data-type="EpochTimeStamp" class="idlName" tabindex="0" aria-haspopup="dialog"><code>expirationTime</code></dfn> = null;</span><span data-idl="" class="idlMember" id="idl-def-pushsubscriptionjson-keys" data-title="keys" data-dfn-for="PushSubscriptionJSON"><span class="idlType"> <a data-type="dfn" href="https://webidl.spec.whatwg.org/#idl-record">record</a>&lt;<a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>, <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a>&gt;</span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionjson-keys" id="ref-for-dom-pushsubscriptionjson-keys-1"><code>keys</code></a>;</span> };</span></code></pre> <p> When <dfn id="dfn-getting-the-endpoint-attribute" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">getting the <code>endpoint</code> attribute</dfn>, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-42">user agent</a> <em class="rfc2119">MUST</em> return the <a href="#dfn-push-endpoint" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-endpoint-11">push endpoint</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-61">push subscription</a>. The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-43">user agent</a> <em class="rfc2119">MUST</em> use a serialization method that does not contain input-dependent branches (that is, one that is constant time). </p> <p> When <dfn id="dfn-getting-the-expirationtime-attribute" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">getting the <code>expirationTime</code> attribute</dfn>, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-44">user agent</a> <em class="rfc2119">MUST</em> return the <a href="#dfn-subscription-expiration-time" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-subscription-expiration-time-1">subscription expiration time</a> associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-62">push subscription</a> if there is one, or <code>null</code> otherwise. </p> <p> When getting the <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscription-options" data-idl="attribute" data-title="options" data-dfn-for="PushSubscription" data-type="PushSubscriptionOptions" data-lt="options" data-local-lt="PushSubscription.options" tabindex="0" aria-haspopup="dialog"><code>options</code></dfn> attribute, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-45">user agent</a> <em class="rfc2119">MUST</em> return a <a href="#dom-pushsubscriptionoptions" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushsubscriptionoptions-6"><code>PushSubscriptionOptions</code></a> object representing the options associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-63">push subscription</a>. </p> <p> The <dfn data-export="" data-dfn-type="method" id="dom-pushsubscription-getkey" data-idl="operation" data-title="getKey()" data-dfn-for="PushSubscription" data-type="ArrayBuffer" data-lt="getKey()|getKey(name)" data-local-lt="PushSubscription.getKey|PushSubscription.getKey()|getKey" tabindex="0" aria-haspopup="dialog"><code>getKey()</code></dfn> method retrieves keying material that can be used for encrypting and authenticating messages. When <a data-link-type="idl" data-lt="getKey()" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-5"><code>getKey</code></a><code>()</code> is invoked the following process is followed: </p> <ol> <li>Find the internal slot corresponding to the key named by the <code>name</code> argument. </li> <li>If a slot was not found, return <code>null</code>. </li> <li>Initialize a variable <var>key</var> with a newly instantiated <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> instance. </li> <li>If the internal slot contains an asymmetric key pair, set the contents of <var>key</var> to the serialized value of the public key from the key pair. This uses the serialization format described in the specification that defines the name. For example, [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>] specifies that the "<a data-link-type="idl" href="#dom-pushencryptionkeyname-p256dh" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-p256dh-3"><code>p256dh</code></a>" public key is encoded using the uncompressed format defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-ansi-x9-62" title="Public Key Cryptography for the Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA)">ANSI-X9-62</a></cite>] Annex A (that is, a 65 octet sequence that starts with a 0x04 octet). </li> <li>Otherwise, if the internal slot contains a symmetric key, set the contents of <var>key</var> to a copy of the value from the internal slot. For example, the <code>auth</code> parameter contains an octet sequence used by the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-46">user agent</a> to authenticate messages sent by an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-24">application server</a>. </li> <li>Return <var>key</var>. </li> </ol> <p data-link-for=""> Keys named "<a data-link-type="idl" href="#dom-pushencryptionkeyname-p256dh" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-p256dh-4"><code>p256dh</code></a>" and "<a data-link-type="idl" href="#dom-pushencryptionkeyname-auth" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-auth-2"><code>auth</code></a>" <em class="rfc2119">MUST</em> be supported, and their values <em class="rfc2119">MUST</em> correspond to those necessary for the user agent to decrypt received push messages in accordance with [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. </p> <p> The <dfn data-lt="unsubscribed|unsubscribe()" data-export="" data-dfn-type="method" id="dom-pushsubscription-unsubscribe" data-idl="operation" data-title="unsubscribe()" data-dfn-for="PushSubscription" data-type="Promise" data-local-lt="PushSubscription.unsubscribe|PushSubscription.unsubscribe()|unsubscribe" tabindex="0" aria-haspopup="dialog"><code>unsubscribe()</code></dfn> method when invoked <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li>Let <var>promise</var> be <a data-type="dfn" href="https://webidl.spec.whatwg.org/#a-new-promise">a new promise</a>. </li> <li>Return <var>promise</var> and continue the following steps asynchronously. </li> <li>If the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-64">push subscription</a> has already been <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-8">deactivated</a>, resolve <var>promise</var> with <code>false</code> and terminate these steps. </li> <li>Run the following step in parallel: <ol> <li> <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-9">Deactivate</a> the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-65">push subscription</a>. The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-47">user agent</a> <em class="rfc2119">MUST NOT</em> deliver any further <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-34">push messages</a> for the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-66">push subscription</a>. <p> If the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-48">user agent</a> failed to request the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-27">push service</a> to <a href="#dfn-deactivate" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-deactivate-10">deactivate</a> the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-67">push subscription</a>, for example because of network failures, it <em class="rfc2119">SHOULD</em> retry the request to the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-28">push service</a> for a reasonable amount of time. </p> </li> </ol> </li> <li>Resolve <var>promise</var> with <code>true</code>. </li> </ol> <p> The <dfn data-export="" data-dfn-type="method" id="dom-pushsubscription-tojson" data-idl="operation" data-title="toJSON()" data-dfn-for="PushSubscription" data-type="PushSubscriptionJSON" data-lt="toJSON()" data-local-lt="PushSubscription.toJSON|PushSubscription.toJSON()|toJSON" tabindex="0" aria-haspopup="dialog"><code>toJSON()</code></dfn> method when invoked <em class="rfc2119">MUST</em> run the following steps: </p> <ol> <li>Let <var data-type="PushSubscriptionJSON">json</var> be a new <a data-link-type="idl" data-lt="PushSubscriptionJSON" href="#dom-pushsubscriptionjson" class="internalDFN" id="ref-for-dom-pushsubscriptionjson-3"><code>PushSubscriptionJSON</code></a> dictionary. </li> <li>Set <var data-type="PushSubscriptionJSON">json</var>["endpoint"] to the result of <a data-link-type="dfn|abstract-op" href="#dfn-getting-the-endpoint-attribute" class="internalDFN" id="ref-for-dfn-getting-the-endpoint-attribute-1">getting the <code>endpoint</code> attribute</a> of <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>. </li> <li>Set <var data-type="PushSubscriptionJSON">json</var>["expirationTime"] to the result of <a data-link-type="dfn|abstract-op" href="#dfn-getting-the-expirationtime-attribute" class="internalDFN" id="ref-for-dfn-getting-the-expirationtime-attribute-1">getting the <code>expirationTime</code> attribute</a> of <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>. </li> <li>Let <var>keys</var> be a new empty instance of <code>record&lt;DOMString, USVString&gt;</code> . </li> <li>For each identifier <var>i</var> corresponding to keys in internal slots on the <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-19"><code>PushSubscription</code></a>, ordered by the name of the key: <ol> <li>If the internal slot corresponds to an asymmetric key pair, let <var>b</var> be the encoded value of the public key corresponding to the key name <var>i</var>, using the encoding defined for the key name (see <a data-link-type="idl" data-lt="getKey()" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-6"><code>getKey</code></a><code>()</code>). </li> <li>Otherwise, let <var>b</var> be the value as returned by <a data-link-type="idl" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-7"><code>getKey</code></a>. </li> <li>Let <var>s</var> be the URL-safe base64 encoding without padding [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4648" title="The Base16, Base32, and Base64 Data Encodings">RFC4648</a></cite>] of <var>b</var> as a <a data-link-type="idl" data-lt="USVString" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString"><code>USVString</code></a>. The <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-49">user agent</a> <em class="rfc2119">MUST</em> use a serialization method that does not branch based on the value of <var>b</var>. </li> <li>Set <var>keys</var>[<var>i</var>] to <var>s</var>. </li> </ol> </li> <li>Set <var data-type="PushSubscriptionJSON">json</var>["keys"] to <var>keys</var>. </li> <li>Return <var data-type="PushSubscriptionJSON">json</var>. </li> </ol> <p> A <dfn data-export="" data-dfn-type="dictionary" id="dom-pushsubscriptionjson" data-idl="dictionary" data-title="PushSubscriptionJSON" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushSubscriptionJSON</code></dfn> dictionary represents the <a data-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-json-types">JSON type</a> of a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-20"><code>PushSubscription</code></a>. In ECMAScript this can be converted into a JSON string through the <code>JSON</code>.<a data-link-type="idl" data-lt="stringify()" data-type="method" href="https://tc39.es/ecma262/multipage/structured-data.html#sec-json.stringify"><code>stringify</code></a><code>()</code> function. </p> <p> The <dfn data-dfn-for="PushSubscriptionJSON" data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionjson-keys" data-idl="field" data-title="keys" data-type="record" tabindex="0" aria-haspopup="dialog"><code>keys</code></dfn> record contains an entry for each of the supported <a data-link-type="idl" data-lt="PushEncryptionKeyName" href="#dom-pushencryptionkeyname" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-2"><code>PushEncryptionKeyName</code></a> entries to the URL-safe base64 encoded representation [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4648" title="The Base16, Base32, and Base64 Data Encodings">RFC4648</a></cite>] of its value. </p> <p> Note that the options to a <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-21"><code>PushSubscription</code></a> are not serialized. </p> <section data-dfn-for="PushEncryptionKeyName" id="pushencryptionkeyname-enumeration"><div class="header-wrapper"><h3 id="x8-1-pushencryptionkeyname-enumeration"><bdi class="secno">8.1 </bdi> <dfn data-export="" data-dfn-type="enum" id="dom-pushencryptionkeyname" data-idl="enum" data-title="PushEncryptionKeyName" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushEncryptionKeyName</code></dfn> enumeration </h3><a class="self-link" href="#pushencryptionkeyname-enumeration" aria-label="Permalink for Section 8.1"></a></div> <p> Encryption keys used for <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-35">push message</a> encryption are provided to a web application through the <a data-link-type="idl" data-lt="getKey()" href="#dom-pushsubscription-getkey" class="internalDFN" id="ref-for-dom-pushsubscription-getkey-8"><code>getKey</code></a><code>()</code> method or the serializer of <a data-link-type="idl" data-lt="PushSubscription" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-22"><code>PushSubscription</code></a>. Each key is named using a value from the <a data-link-type="idl" data-lt="PushEncryptionKeyName" href="#dom-pushencryptionkeyname" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-3"><code>PushEncryptionKeyName</code></a> enumeration. </p> <pre class="idl def" id="webidl-226775330"><span class="idlHeader"><a class="self-link" href="#webidl-226775330">WebIDL</a></span><code><span data-idl="" class="idlEnum" id="idl-def-pushencryptionkeyname" data-title="PushEncryptionKeyName">enum <a class="internalDFN idlID" data-link-type="enum" href="#dom-pushencryptionkeyname" id="ref-for-dom-pushencryptionkeyname-4"><code>PushEncryptionKeyName</code></a> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-pushencryptionkeyname-p256dh" id="ref-for-dom-pushencryptionkeyname-p256dh-5"><code>p256dh</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-pushencryptionkeyname-auth" id="ref-for-dom-pushencryptionkeyname-auth-3"><code>auth</code></a>"</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="enum-value" id="dom-pushencryptionkeyname-p256dh" data-idl="enum-value" data-title="p256dh" data-dfn-for="PushEncryptionKeyName" tabindex="0" aria-haspopup="dialog"><code>p256dh</code></dfn> value is used to retrieve the P-256 <abbr title="elliptic curve Diffie-Hellman">ECDH</abbr> Diffie-Hellman public key described in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. </p> <p> The <dfn data-export="" data-dfn-type="enum-value" id="dom-pushencryptionkeyname-auth" data-idl="enum-value" data-title="auth" data-dfn-for="PushEncryptionKeyName" tabindex="0" aria-haspopup="dialog"><code>auth</code></dfn> value is used to retrieve the authentication secret described in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. </p> </section> </section> <section data-dfn-for="PushMessageData" id="pushmessagedata-interface"><div class="header-wrapper"><h2 id="x9-pushmessagedata-interface"><bdi class="secno">9. </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-pushmessagedata" data-idl="interface" data-title="PushMessageData" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushMessageData</code></dfn> interface </h2><a class="self-link" href="#pushmessagedata-interface" aria-label="Permalink for Section 9."></a></div> <pre class="idl def" data-cite="WEBIDL FILEAPI" id="webidl-1430759589"><span class="idlHeader"><a class="self-link" href="#webidl-1430759589">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-pushmessagedata" data-title="PushMessageData">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushmessagedata" id="ref-for-dom-pushmessagedata-1"><code>PushMessageData</code></a> {<span data-idl="" class="idlMethod" id="idl-def-pushmessagedata-arraybuffer" data-title="arrayBuffer" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer">ArrayBuffer</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-arraybuffer" id="ref-for-dom-pushmessagedata-arraybuffer-1"><code>arrayBuffer</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-pushmessagedata-blob" data-title="blob" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://www.w3.org/TR/FileAPI/#dfn-Blob">Blob</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-blob" id="ref-for-dom-pushmessagedata-blob-1"><code>blob</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-pushmessagedata-bytes" data-title="bytes" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array">Uint8Array</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-bytes" id="ref-for-dom-pushmessagedata-bytes-1"><code>bytes</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-pushmessagedata-json" data-title="json" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-any">any</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-json" id="ref-for-dom-pushmessagedata-json-1"><code>json</code></a>();</span><span data-idl="" class="idlMethod" id="idl-def-pushmessagedata-text" data-title="text" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-text" id="ref-for-dom-pushmessagedata-text-1"><code>text</code></a>();</span> };</span></code></pre> <p> <a data-link-type="idl" data-lt="PushMessageData" href="#dom-pushmessagedata" class="internalDFN" id="ref-for-dom-pushmessagedata-2"><code>PushMessageData</code></a> objects have an associated <dfn id="dfn-bytes" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">bytes</dfn> (a <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence">byte sequence</a>), which is set on creation. </p> <p> The <dfn data-export="" data-dfn-type="method" id="dom-pushmessagedata-arraybuffer" data-idl="operation" data-title="arrayBuffer()" data-dfn-for="PushMessageData" data-type="ArrayBuffer" data-lt="arrayBuffer()" data-local-lt="PushMessageData.arrayBuffer|PushMessageData.arrayBuffer()|arrayBuffer" tabindex="0" aria-haspopup="dialog"><code>arrayBuffer()</code></dfn> method steps are to return an <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> whose contents are <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-bytes" class="internalDFN" id="ref-for-dfn-bytes-1">bytes</a>. Exceptions thrown during the creation of the <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> object are re-thrown. </p> <p> The <dfn data-export="" data-dfn-type="method" id="dom-pushmessagedata-blob" data-idl="operation" data-title="blob()" data-dfn-for="PushMessageData" data-type="Blob" data-lt="blob()" data-local-lt="PushMessageData.blob|PushMessageData.blob()|blob" tabindex="0" aria-haspopup="dialog"><code>blob()</code></dfn> method steps are to return a new <a data-link-type="idl" data-lt="Blob" data-type="interface" href="https://www.w3.org/TR/FileAPI/#dfn-Blob"><code>Blob</code></a> object whose contents are <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-bytes" class="internalDFN" id="ref-for-dfn-bytes-2">bytes</a>. </p> <p> The <dfn data-export="" data-dfn-type="method" id="dom-pushmessagedata-bytes" data-idl="operation" data-title="bytes()" data-dfn-for="PushMessageData" data-type="Uint8Array" data-lt="bytes()" data-local-lt="PushMessageData.bytes|PushMessageData.bytes()|bytes" tabindex="0" aria-haspopup="dialog"><code>bytes()</code></dfn> method steps are to return a new <a data-link-type="idl" data-lt="Uint8Array" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array"><code>Uint8Array</code></a> backed by a <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> whose contents are <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-bytes" class="internalDFN" id="ref-for-dfn-bytes-3">bytes</a>. Exceptions thrown during the creation of the <a data-link-type="idl" data-lt="ArrayBuffer" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer"><code>ArrayBuffer</code></a> object are re-thrown. </p> <p data-cite="encoding"> The <dfn data-export="" data-dfn-type="method" id="dom-pushmessagedata-json" data-idl="operation" data-title="json()" data-dfn-for="PushMessageData" data-type="any" data-lt="json()" data-local-lt="PushMessageData.json|PushMessageData.json()|json" tabindex="0" aria-haspopup="dialog"><code>json()</code></dfn> method steps are to return the result of <a data-type="dfn" href="https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value">parsing JSON bytes to a JavaScript value</a> given <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-bytes" class="internalDFN" id="ref-for-dfn-bytes-4">bytes</a>. </p> <p data-cite="encoding"> The <dfn data-export="" data-dfn-type="method" id="dom-pushmessagedata-text" data-idl="operation" data-title="text()" data-dfn-for="PushMessageData" data-type="USVString" data-lt="text()" data-local-lt="PushMessageData.text|PushMessageData.text()|text" tabindex="0" aria-haspopup="dialog"><code>text()</code></dfn> method steps are to return the result of running <a data-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode">UTF-8 decode</a> on <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://webidl.spec.whatwg.org/#this">this</a>'s <a data-link-type="dfn|abstract-op" href="#dfn-bytes" class="internalDFN" id="ref-for-dfn-bytes-5">bytes</a>. </p> <p> To <dfn id="dfn-extract-a-byte-sequence" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">extract a byte sequence</dfn> from <var>object</var>, run these steps: </p> <ol> <li>Let <var>bytes</var> be an empty byte sequence. </li> <li>Switch on <var>object</var>'s type: <dl data-cite="WebIDL"> <dt> <a data-link-type="idl" data-lt="BufferSource" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource"><code>BufferSource</code></a> </dt> <dd> Set <var>bytes</var> to a copy of <var>object</var>'s contents. </dd> <dt> <a data-link-type="idl" data-lt="USVString" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString"><code>USVString</code></a> </dt> <dd data-cite="encoding"> Set <var>bytes</var> to the result of running <a data-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode">utf-8 encode</a> on <var>object</var>. </dd> </dl> </li> <li>Return <var>bytes</var>. </li> </ol> </section> <section id="events"><div class="header-wrapper"><h2 id="x10-events"><bdi class="secno">10. </bdi> Events </h2><a class="self-link" href="#events" aria-label="Permalink for Section 10."></a></div> <section data-dfn-for="ServiceWorkerGlobalScope" id="extensions-to-the-serviceworkerglobalscope-interface"><div class="header-wrapper"><h3 id="x10-1-extensions-to-the-serviceworkerglobalscope-interface"><bdi class="secno">10.1 </bdi> Extensions to the <code>ServiceWorkerGlobalScope</code> interface </h3><a class="self-link" href="#extensions-to-the-serviceworkerglobalscope-interface" aria-label="Permalink for Section 10.1"></a></div> <p> The Service Worker specification defines a <a data-link-type="idl" data-lt="ServiceWorkerGlobalScope" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerglobalscope"><code>ServiceWorkerGlobalScope</code></a> interface [<cite><a class="bibref" data-link-type="biblio" href="#bib-service-workers" title="Service Workers">SERVICE-WORKERS</a></cite>], which this specification extends. </p> <pre class="idl def" data-cite="WEBIDL HTML" id="webidl-801193280"><span class="idlHeader"><a class="self-link" href="#webidl-801193280">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-serviceworkerglobalscope-partial-1" data-title="ServiceWorkerGlobalScope">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="ServiceWorkerGlobalScope" class="idlID" data-dfn-for="ServiceWorkerGlobalScope" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerglobalscope">ServiceWorkerGlobalScope</a> {<span data-idl="" class="idlAttribute" id="idl-def-serviceworkerglobalscope-onpush" data-title="onpush" data-dfn-for="ServiceWorkerGlobalScope"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-serviceworkerglobalscope-onpush" id="ref-for-dom-serviceworkerglobalscope-onpush-1"><code>onpush</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-serviceworkerglobalscope-onpushsubscriptionchange" data-title="onpushsubscriptionchange" data-dfn-for="ServiceWorkerGlobalScope"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-serviceworkerglobalscope-onpushsubscriptionchange" id="ref-for-dom-serviceworkerglobalscope-onpushsubscriptionchange-1"><code>onpushsubscriptionchange</code></a>;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-serviceworkerglobalscope-onpush" data-idl="attribute" data-title="onpush" data-dfn-for="ServiceWorkerGlobalScope" data-type="EventHandler" data-lt="onpush" data-local-lt="ServiceWorkerGlobalScope.onpush" tabindex="0" aria-haspopup="dialog"><code>onpush</code></dfn> attribute is an <a data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes">event handler IDL attribute</a> whose corresponding <a data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">event handler event type</a> is "<code>push</code>". The "<code>push</code>" event indicates that a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-36">push message</a> has been received for a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-68">push subscription</a>. </p> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-serviceworkerglobalscope-onpushsubscriptionchange" data-idl="attribute" data-title="onpushsubscriptionchange" data-dfn-for="ServiceWorkerGlobalScope" data-type="EventHandler" data-lt="onpushsubscriptionchange" data-local-lt="ServiceWorkerGlobalScope.onpushsubscriptionchange" tabindex="0" aria-haspopup="dialog"><code>onpushsubscriptionchange</code></dfn> attribute is an <a data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes">event handler IDL attribute</a> whose corresponding <a data-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">event handler event type</a> is "<code>pushsubscriptionchange</code>". </p> </section> <section data-dfn-for="PushEvent" id="pushevent-interface"><div class="header-wrapper"><h3 id="x10-2-pushevent-interface"><bdi class="secno">10.2 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-pushevent" data-idl="interface" data-title="PushEvent" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushEvent</code></dfn> Interface </h3><a class="self-link" href="#pushevent-interface" aria-label="Permalink for Section 10.2"></a></div> <pre class="idl def" data-cite="WEBIDL service-workers" id="webidl-302405565"><span class="idlHeader"><a class="self-link" href="#webidl-302405565">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-pushevent" data-title="PushEvent">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushevent" id="ref-for-dom-pushevent-1"><code>PushEvent</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://www.w3.org/TR/service-workers/#extendableevent">ExtendableEvent</a></span> {<span data-idl="" class="idlConstructor" id="idl-def-pushevent-constructor-type-eventinitdict" data-title="constructor" data-dfn-for="PushEvent"> <a class="internalDFN" data-link-type="constructor" href="#dom-pushevent-constructor" id="ref-for-dom-pushevent-constructor-1"><code>constructor</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-pusheventinit" class="internalDFN" id="ref-for-dom-pusheventinit-1"><code>PushEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" id="idl-def-pushevent-data" data-title="data" data-dfn-for="PushEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushmessagedata" class="internalDFN" id="ref-for-dom-pushmessagedata-3"><code>PushMessageData</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushevent-data" id="ref-for-dom-pushevent-data-1"><code>data</code></a>;</span> };</span></code></pre> <p> When a <dfn data-export="" data-dfn-type="constructor" id="dom-pushevent-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="PushEvent" data-lt="constructor()|constructor(type)|constructor(type, eventInitDict)" data-local-lt="PushEvent.constructor|PushEvent.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn> of the <a href="#dom-pushevent" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushevent-2"><code>PushEvent</code></a> interface, or of an interface that inherits from the <a href="#dom-pushevent" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushevent-3"><code>PushEvent</code></a> interface, is invoked, the usual <a data-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-constructor-ext">event constructing steps</a> are extended to include the following steps: </p> <ol> <li>If <var>eventInitDict</var>'s <code>data</code> member is not present, set the <code>data</code> attribute of the event to <code>null</code> and terminate these steps. </li> <li>Set <var>b</var> to the result of <a data-lt="extract a byte sequence" href="#dfn-extract-a-byte-sequence" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-extract-a-byte-sequence-1">extracting a byte sequence</a> from the "<code>data</code>" member of <var>eventInitDict</var>. </li> <li>Set the <code>data</code> attribute of the event to a new <a href="#dom-pushmessagedata" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushmessagedata-4"><code>PushMessageData</code></a> instance with <code>bytes</code> set to <var>b</var>. </li> </ol> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-pushevent-data" data-idl="attribute" data-title="data" data-dfn-for="PushEvent" data-type="PushMessageData" data-lt="data" data-local-lt="PushEvent.data" tabindex="0" aria-haspopup="dialog"><code>data</code></dfn>, when getting, returns the value it was initialized with. </p> </section> <section data-dfn-for="PushEventInit" id="pusheventinit-dictionary"><div class="header-wrapper"><h3 id="x10-3-pusheventinit-dictionary"><bdi class="secno">10.3 </bdi> <dfn data-export="" data-dfn-type="dictionary" id="dom-pusheventinit" data-idl="dictionary" data-title="PushEventInit" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushEventInit</code></dfn> dictionary </h3><a class="self-link" href="#pusheventinit-dictionary" aria-label="Permalink for Section 10.3"></a></div> <pre class="idl def" data-cite="WEBIDL service-workers" id="webidl-173618782"><span class="idlHeader"><a class="self-link" href="#webidl-173618782">WebIDL</a></span><code><span data-idl="" class="idlTypedef" id="idl-def-pushmessagedatainit" data-title="PushMessageDataInit">typedef<span class="idlType"> (<a data-link-type="idl" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource">BufferSource</a> or <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a>)</span> <dfn data-export="" data-dfn-type="typedef" id="dom-pushmessagedatainit" data-idl="typedef" data-title="PushMessageDataInit" data-dfn-for="" class="idlID" tabindex="0" aria-haspopup="dialog"><code>PushMessageDataInit</code></dfn>;</span><span data-idl="" class="idlDictionary" id="idl-def-pusheventinit" data-title="PushEventInit"> dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pusheventinit" id="ref-for-dom-pusheventinit-2"><code>PushEventInit</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://www.w3.org/TR/service-workers/#dictdef-extendableeventinit">ExtendableEventInit</a></span> {<span data-idl="" class="idlMember" id="idl-def-pusheventinit-data" data-title="data" data-dfn-for="PushEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-pushmessagedatainit" class="internalDFN" id="ref-for-dom-pushmessagedatainit-1"><code>PushMessageDataInit</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pusheventinit-data" id="ref-for-dom-pusheventinit-data-1"><code>data</code></a>;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="dict-member" id="dom-pusheventinit-data" data-idl="field" data-title="data" data-dfn-for="PushEventInit" data-type="PushMessageDataInit" tabindex="0" aria-haspopup="dialog"><code>data</code></dfn> member contains the data included in the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-37">push message</a> when included and the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-50">user agent</a> verified its authenticity. The value will be set to <code>null</code> in all other cases. </p> </section> <section id="receiving-a-push-message"><div class="header-wrapper"><h3 id="x10-4-receiving-a-push-message"><bdi class="secno">10.4 </bdi> Receiving a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-38">Push Message</a> </h3><a class="self-link" href="#receiving-a-push-message" aria-label="Permalink for Section 10.4"></a></div> <p> When the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-51">user agent</a> receives a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-39">push message</a> from the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-29">push service</a>, it <em class="rfc2119">MUST</em> run the following steps. </p> <ol> <li>Let <var>registration</var> be the <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> corresponding to the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-40"> push message</a>. </li> <li>If <var>registration</var> is not found, abort these steps. </li> <li>Let <var>subscription</var> be the active <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-69">push subscription</a> for <var>registration</var>. </li> <li>Let <var>bytes</var> be null. </li> <li>If the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-41">push message</a> contains a payload: <ol> <li>Decrypt the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-42">push message</a> payload using the private key from the key pair associated with <var>subscription</var> and the process described in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8291" title="Message Encryption for Web Push">RFC8291</a></cite>]. Set <var>bytes</var> to the resulting <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence">byte sequence</a>. </li> <li>If the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-43">push message</a> payload could not be decrypted for any reason: <ol> <li>Acknowledge the receipt of the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-44">push message</a> according to [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8030" title="Generic Event Delivery Using HTTP Push">RFC8030</a></cite>]. Though the message was not successfully received and processed, this prevents the push service from attempting to retransmit the message; a badly encrypted message is not recoverable. </li> <li>Abort these steps. </li> </ol> <div class="note" role="note" id="issue-container-generatedID-1"><div role="heading" class="note-title marker" id="h-note-1" aria-level="4"><span>Note</span></div><p class=""> A <code>push</code> event will not be fired for a <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-45">push message</a> that was not successfully decrypted using the key pair associated with the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-70">push subscription</a>. </p></div> </li> </ol> </li> <li> <p> <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#fire-functional-event">Fire a functional event</a> named "<code>push</code>" using <a href="#dom-pushevent" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushevent-4"><code>PushEvent</code></a> on <var>registration</var> with the following properties: </p> <dl> <dt> <code>data</code> </dt> <dd> A new <a data-link-type="idl" data-lt="PushMessageData" href="#dom-pushmessagedata" class="internalDFN" id="ref-for-dom-pushmessagedata-5"><code>PushMessageData</code></a> object whose <a data-link-type="dfn|abstract-op" href="#dfn-bytes" class="internalDFN" id="ref-for-dfn-bytes-6">bytes</a> is <var>bytes</var>. </dd> </dl> <p> Then run the following steps in parallel, with <var>dispatchedEvent</var>: </p> <ol> <li>Wait for all of the promises in the <a data-link-type="dfn|abstract-op" data-type="dfn" href="https://www.w3.org/TR/service-workers/#extendableevent-extend-lifetime-promises">extend lifetime promises</a> of <var>dispatchedEvent</var> to resolve. </li> <li>If all the promises resolve successfully, acknowledge the receipt of the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-46">push message</a> according to [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8030" title="Generic Event Delivery Using HTTP Push">RFC8030</a></cite>] and abort these steps. </li> <li> <p> If the same <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-47">push message</a> has been delivered to a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> multiple times unsuccessfully, acknowledge the receipt of the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-48">push message</a> according to [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8030" title="Generic Event Delivery Using HTTP Push">RFC8030</a></cite>]. </p> <p> Acknowledging the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-49">push message</a> causes the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-30">push service</a> to stop delivering the message and to report success to the <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-25">application server</a>. This prevents the same <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-50">push message</a> from being retried by the <a href="#dfn-push-service" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-service-31">push service</a> indefinitely. </p> <p> Acknowledging also means that an <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-26">application server</a> could incorrectly receive a delivery receipt indicating successful delivery of the <a href="#dfn-push-message" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-message-51">push message</a>. Therefore, multiple rejections <em class="rfc2119">SHOULD</em> be permitted before acknowledging; allowing at least three attempts is recommended. </p> </li> </ol> </li> </ol> </section> <section id="the-pushsubscriptionchange-event"><div class="header-wrapper"><h3 id="x10-5-the-pushsubscriptionchange-event"><bdi class="secno">10.5 </bdi> The <dfn id="dfn-pushsubscriptionchange" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">pushsubscriptionchange</dfn> Event </h3><a class="self-link" href="#the-pushsubscriptionchange-event" aria-label="Permalink for Section 10.5"></a></div> <p> The <a href="#dfn-pushsubscriptionchange" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-pushsubscriptionchange-1">pushsubscriptionchange</a> event indicates a change in a <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-71">push subscription</a> that was triggered outside of the application's control, for example because it has been refreshed, revoked or lost. </p> <p> To <dfn id="dfn-fire-the-pushsubscriptionchange-event" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">fire the "<code>pushsubscriptionchange</code>" event</dfn> given a <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registration</a> of <var>registration</var>, <var>newSubscription</var> and <var>oldSubscription</var>, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-52">user agent</a> must <a data-type="dfn" href="https://www.w3.org/TR/service-workers/#fire-functional-event">fire a functional event</a> named "<code>pushsubscriptionchange</code>" using <a href="#dom-pushsubscriptionchangeevent" class="internalDFN" data-link-type="idl" id="ref-for-dom-pushsubscriptionchangeevent-1"><code>PushSubscriptionChangeEvent</code></a> on <var>registration</var> with the following properties: </p> <dl> <dt> <code>newSubscription</code> </dt> <dd> <var>newSubscription</var> </dd> <dt> <code>oldSubscription</code> </dt> <dd> <var>oldSubscription</var> </dd> </dl> <div class="note" role="note" id="issue-container-generatedID-2"><div role="heading" class="note-title marker" id="h-note-2" aria-level="4"><span>Note</span></div><p class=""> Consider using a more reliable synchronization mechanism such as [<cite><a class="bibref" data-link-type="biblio" href="#bib-web-background-sync" title="Web Background Synchronization">WEB-BACKGROUND-SYNC</a></cite>] when sending the details of the new <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-72">push subscription</a> to your <a href="#dfn-application-server" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-application-server-27">application server</a>. The user might be subject to unreliable network conditions that could cause a fetch to fail. </p></div> <section data-dfn-for="PushSubscriptionChangeEvent" id="pushsubscriptionchangeevent-interface"><div class="header-wrapper"><h4 id="x10-5-1-pushsubscriptionchangeevent-interface"><bdi class="secno">10.5.1 </bdi> <dfn data-export="" data-dfn-type="interface" id="dom-pushsubscriptionchangeevent" data-idl="interface" data-title="PushSubscriptionChangeEvent" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushSubscriptionChangeEvent</code></dfn> Interface </h4><a class="self-link" href="#pushsubscriptionchangeevent-interface" aria-label="Permalink for Section 10.5.1"></a></div> <pre class="idl def" data-cite="WEBIDL service-workers" id="webidl-2104077905"><span class="idlHeader"><a class="self-link" href="#webidl-2104077905">WebIDL</a></span><code><span data-idl="" class="idlInterface" id="idl-def-pushsubscriptionchangeevent" data-title="PushSubscriptionChangeEvent">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushsubscriptionchangeevent" id="ref-for-dom-pushsubscriptionchangeevent-2"><code>PushSubscriptionChangeEvent</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://www.w3.org/TR/service-workers/#extendableevent">ExtendableEvent</a></span> {<span data-idl="" class="idlConstructor" id="idl-def-pushsubscriptionchangeevent-constructor-type-eventinitdict" data-title="constructor" data-dfn-for="PushSubscriptionChangeEvent"> <dfn data-export="" data-dfn-type="constructor" id="dom-pushsubscriptionchangeevent-constructor" data-idl="constructor" data-title="constructor" data-dfn-for="PushSubscriptionChangeEvent" data-lt="constructor()|constructor(type)|constructor(type, eventInitDict)" data-local-lt="PushSubscriptionChangeEvent.constructor|PushSubscriptionChangeEvent.constructor()|constructor" tabindex="0" aria-haspopup="dialog"><code>constructor</code></dfn>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionchangeeventinit" class="internalDFN" id="ref-for-dom-pushsubscriptionchangeeventinit-1"><code>PushSubscriptionChangeEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" id="idl-def-pushsubscriptionchangeevent-newsubscription" data-title="newSubscription" data-dfn-for="PushSubscriptionChangeEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-23"><code>PushSubscription</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionchangeevent-newsubscription" id="ref-for-dom-pushsubscriptionchangeevent-newsubscription-1"><code>newSubscription</code></a>;</span><span data-idl="" class="idlAttribute" id="idl-def-pushsubscriptionchangeevent-oldsubscription" data-title="oldSubscription" data-dfn-for="PushSubscriptionChangeEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-24"><code>PushSubscription</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionchangeevent-oldsubscription" id="ref-for-dom-pushsubscriptionchangeevent-oldsubscription-1"><code>oldSubscription</code></a>;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscriptionchangeevent-newsubscription" data-idl="attribute" data-title="newSubscription" data-dfn-for="PushSubscriptionChangeEvent" data-type="PushSubscription" data-lt="newSubscription" data-local-lt="PushSubscriptionChangeEvent.newSubscription" tabindex="0" aria-haspopup="dialog"><code>newSubscription</code></dfn> attribute, when getting, returns the value it was initialized to. </p> <p> The <dfn data-export="" data-dfn-type="attribute" id="dom-pushsubscriptionchangeevent-oldsubscription" data-idl="attribute" data-title="oldSubscription" data-dfn-for="PushSubscriptionChangeEvent" data-type="PushSubscription" data-lt="oldSubscription" data-local-lt="PushSubscriptionChangeEvent.oldSubscription" tabindex="0" aria-haspopup="dialog"><code>oldSubscription</code></dfn> attribute, when getting, returns the value it was initialized to. </p> </section> <section data-dfn-for="PushSubscriptionChangeEventInit" id="pushsubscriptionchangeeventinit-interface"><div class="header-wrapper"><h4 id="x10-5-2-pushsubscriptionchangeeventinit-interface"><bdi class="secno">10.5.2 </bdi> <dfn data-export="" data-dfn-type="dictionary" id="dom-pushsubscriptionchangeeventinit" data-idl="dictionary" data-title="PushSubscriptionChangeEventInit" data-dfn-for="" tabindex="0" aria-haspopup="dialog"><code>PushSubscriptionChangeEventInit</code></dfn> Interface </h4><a class="self-link" href="#pushsubscriptionchangeeventinit-interface" aria-label="Permalink for Section 10.5.2"></a></div> <pre class="idl def" data-cite="WEBIDL service-workers" id="webidl-1842180883"><span class="idlHeader"><a class="self-link" href="#webidl-1842180883">WebIDL</a></span><code><span data-idl="" class="idlDictionary" id="idl-def-pushsubscriptionchangeeventinit" data-title="PushSubscriptionChangeEventInit">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pushsubscriptionchangeeventinit" id="ref-for-dom-pushsubscriptionchangeeventinit-2"><code>PushSubscriptionChangeEventInit</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://www.w3.org/TR/service-workers/#dictdef-extendableeventinit">ExtendableEventInit</a></span> {<span data-idl="" class="idlMember" id="idl-def-pushsubscriptionchangeeventinit-newsubscription" data-title="newSubscription" data-dfn-for="PushSubscriptionChangeEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-25"><code>PushSubscription</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionchangeeventinit-newsubscription" id="ref-for-dom-pushsubscriptionchangeeventinit-newsubscription-1"><code>newSubscription</code></a> = null;</span><span data-idl="" class="idlMember" id="idl-def-pushsubscriptionchangeeventinit-oldsubscription" data-title="oldSubscription" data-dfn-for="PushSubscriptionChangeEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-26"><code>PushSubscription</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionchangeeventinit-oldsubscription" id="ref-for-dom-pushsubscriptionchangeeventinit-oldsubscription-1"><code>oldSubscription</code></a> = null;</span> };</span></code></pre> <p> The <dfn data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionchangeeventinit-newsubscription" data-idl="field" data-title="newSubscription" data-dfn-for="PushSubscriptionChangeEventInit" data-type="PushSubscription" tabindex="0" aria-haspopup="dialog"><code>newSubscription</code></dfn> member details the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-73">push subscription</a> that is valid per invocation of the <a href="#dfn-pushsubscriptionchange" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-pushsubscriptionchange-2">pushsubscriptionchange</a> event. The value will be <code>null</code> when no new <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-74">push subscription</a> could be established, for example because the web application has lost <a data-type="dfn" href="https://www.w3.org/TR/permissions/#dfn-express-permission">express permission</a>. </p> <p> The <dfn data-export="" data-dfn-type="dict-member" id="dom-pushsubscriptionchangeeventinit-oldsubscription" data-idl="field" data-title="oldSubscription" data-dfn-for="PushSubscriptionChangeEventInit" data-type="PushSubscription" tabindex="0" aria-haspopup="dialog"><code>oldSubscription</code></dfn> member details the <a href="#dfn-push-subscription" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-push-subscription-75">push subscription</a> that <em class="rfc2119">SHOULD NOT</em> be used anymore. The value will be <code>null</code> when the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-53">user agent</a> is not able to provide the full set of details, for example because of partial database corruption. </p> </section> </section> </section> <section id="accessibility"><div class="header-wrapper"><h2 id="x11-accessibility"><bdi class="secno">11. </bdi> Accessibility </h2><a class="self-link" href="#accessibility" aria-label="Permalink for Section 11."></a></div> <p> The <cite>Push API</cite> does not provide any means itself to present data it receives from a <a data-link-type="dfn|abstract-op" href="#dfn-push-service" class="internalDFN" id="ref-for-dfn-push-service-32">push service</a>. Instead, the <cite>Push API</cite> relies on other APIs – primarily the <cite><a data-matched-text="[[[NOTIFICATIONS]]]" href="https://notifications.spec.whatwg.org/">Notifications API Standard</a></cite> – to present received information to an end user. As such, there are no accessibility requirements for the <cite>Push API</cite> itself. However, specifications such as [<cite><a class="bibref" data-link-type="biblio" href="#bib-notifications" title="Notifications API Standard">NOTIFICATIONS</a></cite>] provide guidance how to present notifications in an accessible manner. </p> <p> 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. </p> </section> <section id="conformance"><div class="header-wrapper"><h2 id="x12-conformance"><bdi class="secno">12. </bdi>Conformance</h2><a class="self-link" href="#conformance" aria-label="Permalink for Section 12."></a></div><p>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.</p><p> The key words <em class="rfc2119">MAY</em>, <em class="rfc2119">MUST</em>, <em class="rfc2119">MUST NOT</em>, <em class="rfc2119">SHOULD</em>, and <em class="rfc2119">SHOULD NOT</em> in this document are to be interpreted as described in <a href="https://datatracker.ietf.org/doc/html/bcp14">BCP 14</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">RFC2119</a></cite>] [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc8174" title="Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words">RFC8174</a></cite>] when, and only when, they appear in all capitals, as shown here. </p> <p> This specification defines conformance criteria that apply to a single product: the <dfn data-plurals="user agents" id="dfn-user-agent" tabindex="0" aria-haspopup="dialog" data-dfn-type="dfn">user agent</dfn> that implements the interfaces that it contains. </p> </section> <section class="appendix" id="idl-index"><div class="header-wrapper"><h2 id="a-idl-index"><bdi class="secno">A. </bdi>IDL Index</h2><a class="self-link" href="#idl-index" aria-label="Permalink for Appendix A."></a></div><pre class="idl def" id="actual-idl-index"><span class="idlHeader"><a class="self-link" href="#actual-idl-index">WebIDL</a></span><code><span data-idl="" class="idlDictionary" data-title="PushPermissionDescriptor">dictionary <dfn data-export="" data-dfn-type="dictionary" data-idl="dictionary" data-title="PushPermissionDescriptor" data-dfn-for="" class="idlID"><code>PushPermissionDescriptor</code></dfn> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://www.w3.org/TR/permissions/#dom-permissiondescriptor">PermissionDescriptor</a></span> {<span data-idl="" class="idlMember" data-title="userVisibleOnly" data-dfn-for="PushPermissionDescriptor"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushpermissiondescriptor-uservisibleonly" id="ref-for-dom-pushpermissiondescriptor-uservisibleonly-2"><code>userVisibleOnly</code></a> = false;</span> };</span> <span data-idl="" class="idlInterface" data-title="ServiceWorkerRegistration">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="ServiceWorkerRegistration" class="idlID" data-dfn-for="ServiceWorkerRegistration" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerregistration">ServiceWorkerRegistration</a> {<span data-idl="" class="idlAttribute" data-title="pushManager" data-dfn-for="ServiceWorkerRegistration"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushmanager" class="internalDFN" id="ref-for-dom-pushmanager-5"><code>PushManager</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-serviceworkerregistration-pushmanager" id="ref-for-dom-serviceworkerregistration-pushmanager-2"><code>pushManager</code></a>;</span> };</span> <span data-idl="" class="idlInterface" data-title="PushManager">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushmanager" id="ref-for-dom-pushmanager-6"><code>PushManager</code></a> {<span data-idl="" class="idlAttribute" data-title="supportedContentEncodings" data-dfn-for="PushManager"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] static readonly attribute<span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-frozen-array">FrozenArray</a>&lt;<a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>&gt;</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushmanager-supportedcontentencodings" id="ref-for-dom-pushmanager-supportedcontentencodings-2"><code>supportedContentEncodings</code></a>;</span><span data-idl="" class="idlMethod" data-title="subscribe" data-dfn-for="PushManager"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-27"><code>PushSubscription</code></a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmanager-subscribe" id="ref-for-dom-pushmanager-subscribe-3"><code>subscribe</code></a>(optional<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-6"><code>PushSubscriptionOptionsInit</code></a></span> <span class="idlParamName">options</span> = {});</span><span data-idl="" class="idlMethod" data-title="getSubscription" data-dfn-for="PushManager"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-28"><code>PushSubscription</code></a>?&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmanager-getsubscription" id="ref-for-dom-pushmanager-getsubscription-2"><code>getSubscription</code></a>();</span><span data-idl="" class="idlMethod" data-title="permissionState" data-dfn-for="PushManager"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" data-type="enum" href="https://www.w3.org/TR/permissions/#dom-permissionstate">PermissionState</a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmanager-permissionstate" id="ref-for-dom-pushmanager-permissionstate-2"><code>permissionState</code></a>(optional<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionoptionsinit" class="internalDFN" id="ref-for-dom-pushsubscriptionoptionsinit-7"><code>PushSubscriptionOptionsInit</code></a></span> <span class="idlParamName">options</span> = {});</span> };</span> <span data-idl="" class="idlInterface" data-title="PushSubscriptionOptions">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushsubscriptionoptions" id="ref-for-dom-pushsubscriptionoptions-7"><code>PushSubscriptionOptions</code></a> {<span data-idl="" class="idlAttribute" data-title="userVisibleOnly" data-dfn-for="PushSubscriptionOptions"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionoptions-uservisibleonly" id="ref-for-dom-pushsubscriptionoptions-uservisibleonly-2"><code>userVisibleOnly</code></a>;</span><span data-idl="" class="idlAttribute" data-title="applicationServerKey" data-dfn-for="PushSubscriptionOptions"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer">ArrayBuffer</a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionoptions-applicationserverkey" id="ref-for-dom-pushsubscriptionoptions-applicationserverkey-8"><code>applicationServerKey</code></a>;</span> };</span> <span data-idl="" class="idlDictionary" data-title="PushSubscriptionOptionsInit">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pushsubscriptionoptionsinit" id="ref-for-dom-pushsubscriptionoptionsinit-8"><code>PushSubscriptionOptionsInit</code></a> {<span data-idl="" class="idlMember" data-title="userVisibleOnly" data-dfn-for="PushSubscriptionOptionsInit"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionoptionsinit-uservisibleonly" id="ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-5"><code>userVisibleOnly</code></a> = false;</span><span data-idl="" class="idlMember" data-title="applicationServerKey" data-dfn-for="PushSubscriptionOptionsInit"><span class="idlType"> (<a data-link-type="idl" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource">BufferSource</a> or <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>)?</span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" id="ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-7"><code>applicationServerKey</code></a> = null;</span> };</span> <span data-idl="" class="idlInterface" data-title="PushSubscription">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=(Window,Worker)</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushsubscription" id="ref-for-dom-pushsubscription-29"><code>PushSubscription</code></a> {<span data-idl="" class="idlAttribute" data-title="endpoint" data-dfn-for="PushSubscription"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a></span> <dfn data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="endpoint" data-dfn-for="PushSubscription" data-type="USVString" data-lt="endpoint" data-local-lt="PushSubscription.endpoint" class="idlName"><code>endpoint</code></dfn>;</span><span data-idl="" class="idlAttribute" data-title="expirationTime" data-dfn-for="PushSubscription"> readonly attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://www.w3.org/TR/hr-time-3/#dom-epochtimestamp">EpochTimeStamp</a>?</span> <dfn data-export="" data-dfn-type="attribute" data-idl="attribute" data-title="expirationTime" data-dfn-for="PushSubscription" data-type="EpochTimeStamp" data-lt="expirationTime" data-local-lt="PushSubscription.expirationTime" class="idlName"><code>expirationTime</code></dfn>;</span><span data-idl="" class="idlAttribute" data-title="options" data-dfn-for="PushSubscription"> [<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SameObject">SameObject</a></span>] readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionoptions" class="internalDFN" id="ref-for-dom-pushsubscriptionoptions-8"><code>PushSubscriptionOptions</code></a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscription-options" id="ref-for-dom-pushsubscription-options-3"><code>options</code></a>;</span><span data-idl="" class="idlMethod" data-title="getKey" data-dfn-for="PushSubscription"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer">ArrayBuffer</a>?</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushsubscription-getkey" id="ref-for-dom-pushsubscription-getkey-9"><code>getKey</code></a>(<span class="idlType"><a data-link-type="idl" href="#dom-pushencryptionkeyname" class="internalDFN" id="ref-for-dom-pushencryptionkeyname-5"><code>PushEncryptionKeyName</code></a></span> <span class="idlParamName">name</span>);</span><span data-idl="" class="idlMethod" data-title="unsubscribe" data-dfn-for="PushSubscription"><span class="idlType"> <a data-type="interface" href="https://webidl.spec.whatwg.org/#idl-promise">Promise</a>&lt;<a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean">boolean</a>&gt;</span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushsubscription-unsubscribe" id="ref-for-dom-pushsubscription-unsubscribe-3"><code>unsubscribe</code></a>();</span><span data-idl="" class="idlMethod" data-title="toJSON" data-dfn-for="PushSubscription"><span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionjson" class="internalDFN" id="ref-for-dom-pushsubscriptionjson-4"><code>PushSubscriptionJSON</code></a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushsubscription-tojson" id="ref-for-dom-pushsubscription-tojson-2"><code>toJSON</code></a>();</span> };</span><span data-idl="" class="idlDictionary" data-title="PushSubscriptionJSON"> dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pushsubscriptionjson" id="ref-for-dom-pushsubscriptionjson-5"><code>PushSubscriptionJSON</code></a> {<span data-idl="" class="idlMember" data-title="endpoint" data-dfn-for="PushSubscriptionJSON"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a></span> <dfn data-export="" data-dfn-type="dict-member" data-idl="field" data-title="endpoint" data-dfn-for="PushSubscriptionJSON" data-type="USVString" class="idlName"><code>endpoint</code></dfn>;</span><span data-idl="" class="idlMember" data-title="expirationTime" data-dfn-for="PushSubscriptionJSON"><span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://www.w3.org/TR/hr-time-3/#dom-epochtimestamp">EpochTimeStamp</a>?</span> <dfn data-export="" data-dfn-type="dict-member" data-idl="field" data-title="expirationTime" data-dfn-for="PushSubscriptionJSON" data-type="EpochTimeStamp" class="idlName"><code>expirationTime</code></dfn> = null;</span><span data-idl="" class="idlMember" data-title="keys" data-dfn-for="PushSubscriptionJSON"><span class="idlType"> <a data-type="dfn" href="https://webidl.spec.whatwg.org/#idl-record">record</a>&lt;<a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a>, <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a>&gt;</span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionjson-keys" id="ref-for-dom-pushsubscriptionjson-keys-2"><code>keys</code></a>;</span> };</span> <span data-idl="" class="idlEnum" data-title="PushEncryptionKeyName">enum <a class="internalDFN idlID" data-link-type="enum" href="#dom-pushencryptionkeyname" id="ref-for-dom-pushencryptionkeyname-6"><code>PushEncryptionKeyName</code></a> { <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-pushencryptionkeyname-p256dh" id="ref-for-dom-pushencryptionkeyname-p256dh-6"><code>p256dh</code></a>"</span>, <span class="idlEnumItem">"<a class="internalDFN" data-link-type="enum-value" href="#dom-pushencryptionkeyname-auth" id="ref-for-dom-pushencryptionkeyname-auth-4"><code>auth</code></a>"</span> };</span> <span data-idl="" class="idlInterface" data-title="PushMessageData">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushmessagedata" id="ref-for-dom-pushmessagedata-6"><code>PushMessageData</code></a> {<span data-idl="" class="idlMethod" data-title="arrayBuffer" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer">ArrayBuffer</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-arraybuffer" id="ref-for-dom-pushmessagedata-arraybuffer-2"><code>arrayBuffer</code></a>();</span><span data-idl="" class="idlMethod" data-title="blob" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://www.w3.org/TR/FileAPI/#dfn-Blob">Blob</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-blob" id="ref-for-dom-pushmessagedata-blob-2"><code>blob</code></a>();</span><span data-idl="" class="idlMethod" data-title="bytes" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array">Uint8Array</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-bytes" id="ref-for-dom-pushmessagedata-bytes-2"><code>bytes</code></a>();</span><span data-idl="" class="idlMethod" data-title="json" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-any">any</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-json" id="ref-for-dom-pushmessagedata-json-2"><code>json</code></a>();</span><span data-idl="" class="idlMethod" data-title="text" data-dfn-for="PushMessageData"><span class="idlType"> <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a></span> <a class="internalDFN idlName" data-link-type="method" href="#dom-pushmessagedata-text" id="ref-for-dom-pushmessagedata-text-2"><code>text</code></a>();</span> };</span> <span data-idl="" class="idlInterface" data-title="ServiceWorkerGlobalScope">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] partial interface <a data-idl="partial" data-link-type="interface" data-title="ServiceWorkerGlobalScope" class="idlID" data-dfn-for="ServiceWorkerGlobalScope" data-type="interface" href="https://www.w3.org/TR/service-workers/#serviceworkerglobalscope">ServiceWorkerGlobalScope</a> {<span data-idl="" class="idlAttribute" data-title="onpush" data-dfn-for="ServiceWorkerGlobalScope"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-serviceworkerglobalscope-onpush" id="ref-for-dom-serviceworkerglobalscope-onpush-2"><code>onpush</code></a>;</span><span data-idl="" class="idlAttribute" data-title="onpushsubscriptionchange" data-dfn-for="ServiceWorkerGlobalScope"> attribute<span class="idlType"> <a data-link-type="idl" data-type="typedef" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a></span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-serviceworkerglobalscope-onpushsubscriptionchange" id="ref-for-dom-serviceworkerglobalscope-onpushsubscriptionchange-2"><code>onpushsubscriptionchange</code></a>;</span> };</span> <span data-idl="" class="idlInterface" data-title="PushEvent">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushevent" id="ref-for-dom-pushevent-5"><code>PushEvent</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://www.w3.org/TR/service-workers/#extendableevent">ExtendableEvent</a></span> {<span data-idl="" class="idlConstructor" data-title="constructor" data-dfn-for="PushEvent"> <a class="internalDFN" data-link-type="constructor" href="#dom-pushevent-constructor" id="ref-for-dom-pushevent-constructor-2"><code>constructor</code></a>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-pusheventinit" class="internalDFN" id="ref-for-dom-pusheventinit-3"><code>PushEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" data-title="data" data-dfn-for="PushEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushmessagedata" class="internalDFN" id="ref-for-dom-pushmessagedata-7"><code>PushMessageData</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushevent-data" id="ref-for-dom-pushevent-data-2"><code>data</code></a>;</span> };</span> <span data-idl="" class="idlTypedef" data-title="PushMessageDataInit">typedef<span class="idlType"> (<a data-link-type="idl" data-type="typedef" href="https://webidl.spec.whatwg.org/#BufferSource">BufferSource</a> or <a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString">USVString</a>)</span> <dfn data-export="" data-dfn-type="typedef" data-idl="typedef" data-title="PushMessageDataInit" data-dfn-for="" class="idlID"><code>PushMessageDataInit</code></dfn>;</span><span data-idl="" class="idlDictionary" data-title="PushEventInit"> dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pusheventinit" id="ref-for-dom-pusheventinit-4"><code>PushEventInit</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://www.w3.org/TR/service-workers/#dictdef-extendableeventinit">ExtendableEventInit</a></span> {<span data-idl="" class="idlMember" data-title="data" data-dfn-for="PushEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-pushmessagedatainit" class="internalDFN" id="ref-for-dom-pushmessagedatainit-2"><code>PushMessageDataInit</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pusheventinit-data" id="ref-for-dom-pusheventinit-data-2"><code>data</code></a>;</span> };</span> <span data-idl="" class="idlInterface" data-title="PushSubscriptionChangeEvent">[<span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed">Exposed</a>=ServiceWorker</span>, <span class="extAttr"><a data-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext">SecureContext</a></span>] interface <a class="internalDFN idlID" data-link-type="interface" href="#dom-pushsubscriptionchangeevent" id="ref-for-dom-pushsubscriptionchangeevent-3"><code>PushSubscriptionChangeEvent</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="interface" href="https://www.w3.org/TR/service-workers/#extendableevent">ExtendableEvent</a></span> {<span data-idl="" class="idlConstructor" data-title="constructor" data-dfn-for="PushSubscriptionChangeEvent"> <dfn data-export="" data-dfn-type="constructor" data-idl="constructor" data-title="constructor" data-dfn-for="PushSubscriptionChangeEvent" data-lt="constructor()|constructor(type)|constructor(type, eventInitDict)" data-local-lt="PushSubscriptionChangeEvent.constructor|PushSubscriptionChangeEvent.constructor()|constructor"><code>constructor</code></dfn>(<span class="idlType"><a data-link-type="idl" data-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString">DOMString</a></span> <span class="idlParamName">type</span>, optional<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscriptionchangeeventinit" class="internalDFN" id="ref-for-dom-pushsubscriptionchangeeventinit-3"><code>PushSubscriptionChangeEventInit</code></a></span> <span class="idlParamName">eventInitDict</span> = {});</span><span data-idl="" class="idlAttribute" data-title="newSubscription" data-dfn-for="PushSubscriptionChangeEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-30"><code>PushSubscription</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionchangeevent-newsubscription" id="ref-for-dom-pushsubscriptionchangeevent-newsubscription-2"><code>newSubscription</code></a>;</span><span data-idl="" class="idlAttribute" data-title="oldSubscription" data-dfn-for="PushSubscriptionChangeEvent"> readonly attribute<span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-31"><code>PushSubscription</code></a>?</span> <a class="internalDFN idlName" data-link-type="attribute" href="#dom-pushsubscriptionchangeevent-oldsubscription" id="ref-for-dom-pushsubscriptionchangeevent-oldsubscription-2"><code>oldSubscription</code></a>;</span> };</span> <span data-idl="" class="idlDictionary" data-title="PushSubscriptionChangeEventInit">dictionary <a class="internalDFN idlID" data-link-type="dictionary" href="#dom-pushsubscriptionchangeeventinit" id="ref-for-dom-pushsubscriptionchangeeventinit-4"><code>PushSubscriptionChangeEventInit</code></a> : <span class="idlSuperclass"><a data-link-type="idl" data-type="dictionary" href="https://www.w3.org/TR/service-workers/#dictdef-extendableeventinit">ExtendableEventInit</a></span> {<span data-idl="" class="idlMember" data-title="newSubscription" data-dfn-for="PushSubscriptionChangeEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-32"><code>PushSubscription</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionchangeeventinit-newsubscription" id="ref-for-dom-pushsubscriptionchangeeventinit-newsubscription-2"><code>newSubscription</code></a> = null;</span><span data-idl="" class="idlMember" data-title="oldSubscription" data-dfn-for="PushSubscriptionChangeEventInit"><span class="idlType"> <a data-link-type="idl" href="#dom-pushsubscription" class="internalDFN" id="ref-for-dom-pushsubscription-33"><code>PushSubscription</code></a></span> <a class="internalDFN idlName" data-link-type="dict-member" href="#dom-pushsubscriptionchangeeventinit-oldsubscription" id="ref-for-dom-pushsubscriptionchangeeventinit-oldsubscription-2"><code>oldSubscription</code></a> = null;</span> };</span></code></pre></section> <section class="appendix" id="acknowledgements"><div class="header-wrapper"><h2 id="b-acknowledgements"><bdi class="secno">B. </bdi> Acknowledgements </h2><a class="self-link" href="#acknowledgements" aria-label="Permalink for Appendix B."></a></div> <p> 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. </p> </section> <section id="references" class="appendix"><div class="header-wrapper"><h2 id="c-references"><bdi class="secno">C. </bdi>References</h2><a class="self-link" href="#references" aria-label="Permalink for Appendix C."></a></div><section id="normative-references"><div class="header-wrapper"><h3 id="c-1-normative-references"><bdi class="secno">C.1 </bdi>Normative references</h3><a class="self-link" href="#normative-references" aria-label="Permalink for Appendix C.1"></a></div> <dl class="bibliography"><dt id="bib-ansi-x9-62">[ANSI-X9-62]</dt><dd> <a href="https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.62%3a2005"><cite>Public Key Cryptography for the Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA)</cite></a>. ANSI. 2005. URL: <a href="https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.62%3a2005">https://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.62%3a2005</a> </dd><dt id="bib-dom">[dom]</dt><dd> <a href="https://dom.spec.whatwg.org/"><cite>DOM Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a> </dd><dt id="bib-dss">[DSS]</dt><dd> <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf"><cite>FIPS PUB 186-5: Digital Signature Standard (DSS)</cite></a>. U.S. Department of Commerce/National Institute of Standards and Technology. 3 February 2023. National Standard. URL: <a href="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf">https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf</a> </dd><dt id="bib-ecmascript">[ecmascript]</dt><dd> <a href="https://tc39.es/ecma262/multipage/"><cite>ECMAScript Language Specification</cite></a>. Ecma International. URL: <a href="https://tc39.es/ecma262/multipage/">https://tc39.es/ecma262/multipage/</a> </dd><dt id="bib-encoding">[encoding]</dt><dd> <a href="https://encoding.spec.whatwg.org/"><cite>Encoding Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a> </dd><dt id="bib-fileapi">[fileapi]</dt><dd> <a href="https://www.w3.org/TR/FileAPI/"><cite>File API</cite></a>. Marijn Kruisselbrink. W3C. 24 May 2024. W3C Working Draft. URL: <a href="https://www.w3.org/TR/FileAPI/">https://www.w3.org/TR/FileAPI/</a> </dd><dt id="bib-hr-time">[hr-time]</dt><dd> <a href="https://www.w3.org/TR/hr-time-3/"><cite>High Resolution Time</cite></a>. Yoav Weiss. W3C. 19 July 2023. W3C Working Draft. URL: <a href="https://www.w3.org/TR/hr-time-3/">https://www.w3.org/TR/hr-time-3/</a> </dd><dt id="bib-html">[html]</dt><dd> <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> </dd><dt id="bib-infra">[infra]</dt><dd> <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> </dd><dt id="bib-notifications">[NOTIFICATIONS]</dt><dd> <a href="https://notifications.spec.whatwg.org/"><cite>Notifications API Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://notifications.spec.whatwg.org/">https://notifications.spec.whatwg.org/</a> </dd><dt id="bib-permissions">[Permissions]</dt><dd> <a href="https://www.w3.org/TR/permissions/"><cite>Permissions</cite></a>. Marcos Caceres; Mike Taylor. W3C. 19 March 2024. W3C Working Draft. URL: <a href="https://www.w3.org/TR/permissions/">https://www.w3.org/TR/permissions/</a> </dd><dt id="bib-rfc2119">[RFC2119]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. S. Bradner. IETF. March 1997. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc2119">https://www.rfc-editor.org/rfc/rfc2119</a> </dd><dt id="bib-rfc4648">[RFC4648]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc4648"><cite>The Base16, Base32, and Base64 Data Encodings</cite></a>. S. Josefsson. IETF. October 2006. Proposed Standard. URL: <a href="https://www.rfc-editor.org/rfc/rfc4648">https://www.rfc-editor.org/rfc/rfc4648</a> </dd><dt id="bib-rfc7231">[RFC7231]</dt><dd> <a href="https://httpwg.org/specs/rfc7231.html"><cite>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</cite></a>. R. Fielding, Ed.; J. Reschke, Ed.. IETF. June 2014. Proposed Standard. URL: <a href="https://httpwg.org/specs/rfc7231.html">https://httpwg.org/specs/rfc7231.html</a> </dd><dt id="bib-rfc7515">[RFC7515]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc7515"><cite>JSON Web Signature (JWS)</cite></a>. M. Jones; J. Bradley; N. Sakimura. IETF. May 2015. Proposed Standard. URL: <a href="https://www.rfc-editor.org/rfc/rfc7515">https://www.rfc-editor.org/rfc/rfc7515</a> </dd><dt id="bib-rfc8030">[RFC8030]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc8030"><cite>Generic Event Delivery Using HTTP Push</cite></a>. M. Thomson; E. Damaggio; B. Raymor, Ed.. IETF. December 2016. Proposed Standard. URL: <a href="https://www.rfc-editor.org/rfc/rfc8030">https://www.rfc-editor.org/rfc/rfc8030</a> </dd><dt id="bib-rfc8174">[RFC8174]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc8174"><cite>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</cite></a>. B. Leiba. IETF. May 2017. Best Current Practice. URL: <a href="https://www.rfc-editor.org/rfc/rfc8174">https://www.rfc-editor.org/rfc/rfc8174</a> </dd><dt id="bib-rfc8291">[RFC8291]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc8291"><cite>Message Encryption for Web Push</cite></a>. M. Thomson. IETF. November 2017. Proposed Standard. URL: <a href="https://www.rfc-editor.org/rfc/rfc8291">https://www.rfc-editor.org/rfc/rfc8291</a> </dd><dt id="bib-rfc8292">[RFC8292]</dt><dd> <a href="https://www.rfc-editor.org/rfc/rfc8292"><cite>Voluntary Application Server Identification (VAPID) for Web Push</cite></a>. M. Thomson; P. Beverloo. IETF. November 2017. Proposed Standard. URL: <a href="https://www.rfc-editor.org/rfc/rfc8292">https://www.rfc-editor.org/rfc/rfc8292</a> </dd><dt id="bib-service-workers">[SERVICE-WORKERS]</dt><dd> <a href="https://www.w3.org/TR/service-workers/"><cite>Service Workers</cite></a>. Jake Archibald; Marijn Kruisselbrink. W3C. 12 July 2022. W3C Candidate Recommendation. URL: <a href="https://www.w3.org/TR/service-workers/">https://www.w3.org/TR/service-workers/</a> </dd><dt id="bib-webidl">[WEBIDL]</dt><dd> <a href="https://webidl.spec.whatwg.org/"><cite>Web IDL Standard</cite></a>. Edgar Chen; Timothy Gu. WHATWG. Living Standard. URL: <a href="https://webidl.spec.whatwg.org/">https://webidl.spec.whatwg.org/</a> </dd></dl> </section><section id="informative-references"><div class="header-wrapper"><h3 id="c-2-informative-references"><bdi class="secno">C.2 </bdi>Informative references</h3><a class="self-link" href="#informative-references" aria-label="Permalink for Appendix C.2"></a></div> <dl class="bibliography"><dt id="bib-fetch">[Fetch]</dt><dd> <a href="https://fetch.spec.whatwg.org/"><cite>Fetch Standard</cite></a>. Anne van Kesteren. WHATWG. Living Standard. URL: <a href="https://fetch.spec.whatwg.org/">https://fetch.spec.whatwg.org/</a> </dd><dt id="bib-web-background-sync">[WEB-BACKGROUND-SYNC]</dt><dd> <a href="https://wicg.github.io/background-sync/spec/"><cite>Web Background Synchronization</cite></a>. WICG. cg-draft. URL: <a href="https://wicg.github.io/background-sync/spec/">https://wicg.github.io/background-sync/spec/</a> </dd><dt id="bib-websockets">[WebSockets]</dt><dd> <a href="https://websockets.spec.whatwg.org/"><cite>WebSockets Standard</cite></a>. Adam Rice. WHATWG. Living Standard. URL: <a href="https://websockets.spec.whatwg.org/">https://websockets.spec.whatwg.org/</a> </dd></dl> </section></section><p role="navigation" id="back-to-top"> <a href="#title"><abbr title="Back to Top">↑</abbr></a> </p><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-web-push-protocol" aria-label="Links in this document to definition: web push protocol"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-web-push-protocol" aria-label="Permalink for definition: web push protocol. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-web-push-protocol-1" title="§ Abstract">§ Abstract</a> </li><li> <a href="#ref-for-dfn-web-push-protocol-2" title="§ 5.3 Push service use">§ 5.3 Push service use</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-content-encoding" aria-label="Links in this document to definition: Content-Encoding"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-content-encoding" aria-label="Permalink for definition: Content-Encoding. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-content-encoding-1" title="§ 7. PushManager interface">§ 7. PushManager interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-application-server" aria-label="Links in this document to definition: application server"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-application-server" aria-label="Permalink for definition: application server. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-application-server-1" title="§ Abstract">§ Abstract</a> <a href="#ref-for-dfn-application-server-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-application-server-3" title="§ 1. Introduction">§ 1. Introduction</a> <a href="#ref-for-dfn-application-server-4" title="Reference 2">(2)</a> <a href="#ref-for-dfn-application-server-5" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-application-server-6" title="§ 2. Dependencies">§ 2. Dependencies</a> </li><li> <a href="#ref-for-dfn-application-server-7" title="§ 3.2 Push message">§ 3.2 Push message</a> </li><li> <a href="#ref-for-dfn-application-server-8" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dfn-application-server-9" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> </li><li> <a href="#ref-for-dfn-application-server-10" title="§ 3.4 Push service">§ 3.4 Push service</a> </li><li> <a href="#ref-for-dfn-application-server-11" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-application-server-12" title="Reference 2">(2)</a> <a href="#ref-for-dfn-application-server-13" title="Reference 3">(3)</a> <a href="#ref-for-dfn-application-server-14" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-application-server-15" title="§ 5. Push Framework">§ 5. Push Framework</a> <a href="#ref-for-dfn-application-server-16" title="Reference 2">(2)</a> <a href="#ref-for-dfn-application-server-17" title="Reference 3">(3)</a> <a href="#ref-for-dfn-application-server-18" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-application-server-19" title="§ 5.3 Push service use">§ 5.3 Push service use</a> <a href="#ref-for-dfn-application-server-20" title="Reference 2">(2)</a> <a href="#ref-for-dfn-application-server-21" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-application-server-22" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> <a href="#ref-for-dfn-application-server-23" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-application-server-24" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dfn-application-server-25" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> <a href="#ref-for-dfn-application-server-26" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-application-server-27" title="§ 10.5 The pushsubscriptionchange Event">§ 10.5 The pushsubscriptionchange Event</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-push-message" aria-label="Links in this document to definition: push message"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-push-message" aria-label="Permalink for definition: push message. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-push-message-1" title="§ Abstract">§ Abstract</a> <a href="#ref-for-dfn-push-message-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-message-4" title="§ 1. Introduction">§ 1. Introduction</a> <a href="#ref-for-dfn-push-message-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-6" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-message-7" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-message-8" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-message-9" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-message-10" title="Reference 7">(7)</a> <a href="#ref-for-dfn-push-message-11" title="Reference 8">(8)</a> <a href="#ref-for-dfn-push-message-12" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-dfn-push-message-13" title="§ 2. Dependencies">§ 2. Dependencies</a> </li><li> <a href="#ref-for-dfn-push-message-14" title="§ 3.2 Push message">§ 3.2 Push message</a> </li><li> <a href="#ref-for-dfn-push-message-15" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dfn-push-message-16" title="§ 3.3.2 Subscription Deactivation">§ 3.3.2 Subscription Deactivation</a> </li><li> <a href="#ref-for-dfn-push-message-17" title="§ 3.4 Push service">§ 3.4 Push service</a> </li><li> <a href="#ref-for-dfn-push-message-18" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-push-message-19" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-20" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-message-21" title="§ 5. Push Framework">§ 5. Push Framework</a> <a href="#ref-for-dfn-push-message-22" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-23" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-message-24" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-push-message-25" title="§ 5.3 Push service use">§ 5.3 Push service use</a> <a href="#ref-for-dfn-push-message-26" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-27" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-message-28" title="§ 7. PushManager interface">§ 7. PushManager interface</a> <a href="#ref-for-dfn-push-message-29" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-message-30" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> <a href="#ref-for-dfn-push-message-31" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-32" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-message-33" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-push-message-34" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dfn-push-message-35" title="§ 8.1 PushEncryptionKeyName enumeration">§ 8.1 PushEncryptionKeyName enumeration</a> </li><li> <a href="#ref-for-dfn-push-message-36" title="§ 10.1 Extensions to the ServiceWorkerGlobalScope interface">§ 10.1 Extensions to the ServiceWorkerGlobalScope interface</a> </li><li> <a href="#ref-for-dfn-push-message-37" title="§ 10.3 PushEventInit dictionary">§ 10.3 PushEventInit dictionary</a> </li><li> <a href="#ref-for-dfn-push-message-38" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> <a href="#ref-for-dfn-push-message-39" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-message-40" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-message-41" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-message-42" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-message-43" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-message-44" title="Reference 7">(7)</a> <a href="#ref-for-dfn-push-message-45" title="Reference 8">(8)</a> <a href="#ref-for-dfn-push-message-46" title="Reference 9">(9)</a> <a href="#ref-for-dfn-push-message-47" title="Reference 10">(10)</a> <a href="#ref-for-dfn-push-message-48" title="Reference 11">(11)</a> <a href="#ref-for-dfn-push-message-49" title="Reference 12">(12)</a> <a href="#ref-for-dfn-push-message-50" title="Reference 13">(13)</a> <a href="#ref-for-dfn-push-message-51" title="Reference 14">(14)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-push-subscription" aria-label="Links in this document to definition: push subscription"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-push-subscription" aria-label="Permalink for definition: push subscription. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-push-subscription-1" title="§ 3.2 Push message">§ 3.2 Push message</a> </li><li> <a href="#ref-for-dfn-push-subscription-2" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dfn-push-subscription-3" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-4" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-5" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-subscription-6" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-subscription-7" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-subscription-8" title="Reference 7">(7)</a> <a href="#ref-for-dfn-push-subscription-9" title="Reference 8">(8)</a> <a href="#ref-for-dfn-push-subscription-10" title="Reference 9">(9)</a> <a href="#ref-for-dfn-push-subscription-11" title="Reference 10">(10)</a> <a href="#ref-for-dfn-push-subscription-12" title="Reference 11">(11)</a> <a href="#ref-for-dfn-push-subscription-13" title="Reference 12">(12)</a> <a href="#ref-for-dfn-push-subscription-14" title="Reference 13">(13)</a> <a href="#ref-for-dfn-push-subscription-15" title="Reference 14">(14)</a> </li><li> <a href="#ref-for-dfn-push-subscription-16" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> <a href="#ref-for-dfn-push-subscription-17" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-18" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-19" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-subscription-20" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-subscription-21" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-subscription-22" title="Reference 7">(7)</a> <a href="#ref-for-dfn-push-subscription-23" title="Reference 8">(8)</a> <a href="#ref-for-dfn-push-subscription-24" title="Reference 9">(9)</a> <a href="#ref-for-dfn-push-subscription-25" title="Reference 10">(10)</a> <a href="#ref-for-dfn-push-subscription-26" title="Reference 11">(11)</a> <a href="#ref-for-dfn-push-subscription-27" title="Reference 12">(12)</a> <a href="#ref-for-dfn-push-subscription-28" title="Reference 13">(13)</a> </li><li> <a href="#ref-for-dfn-push-subscription-29" title="§ 3.3.2 Subscription Deactivation">§ 3.3.2 Subscription Deactivation</a> <a href="#ref-for-dfn-push-subscription-30" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-31" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-32" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-subscription-33" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-push-subscription-34" title="§ 3.4 Push service">§ 3.4 Push service</a> <a href="#ref-for-dfn-push-subscription-35" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-subscription-36" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-push-subscription-37" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-38" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-39" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-subscription-40" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-subscription-41" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-subscription-42" title="Reference 7">(7)</a> <a href="#ref-for-dfn-push-subscription-43" title="Reference 8">(8)</a> <a href="#ref-for-dfn-push-subscription-44" title="Reference 9">(9)</a> <a href="#ref-for-dfn-push-subscription-45" title="Reference 10">(10)</a> </li><li> <a href="#ref-for-dfn-push-subscription-46" title="§ 5. Push Framework">§ 5. Push Framework</a> </li><li> <a href="#ref-for-dfn-push-subscription-47" title="§ 5.3 Push service use">§ 5.3 Push service use</a> <a href="#ref-for-dfn-push-subscription-48" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-subscription-49" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> <a href="#ref-for-dfn-push-subscription-50" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-51" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-52" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-push-subscription-53" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> <a href="#ref-for-dfn-push-subscription-54" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-55" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-56" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-subscription-57" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-subscription-58" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-subscription-59" title="Reference 7">(7)</a> </li><li> <a href="#ref-for-dfn-push-subscription-60" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dfn-push-subscription-61" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-62" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-subscription-63" title="Reference 4">(4)</a> <a href="#ref-for-dfn-push-subscription-64" title="Reference 5">(5)</a> <a href="#ref-for-dfn-push-subscription-65" title="Reference 6">(6)</a> <a href="#ref-for-dfn-push-subscription-66" title="Reference 7">(7)</a> <a href="#ref-for-dfn-push-subscription-67" title="Reference 8">(8)</a> </li><li> <a href="#ref-for-dfn-push-subscription-68" title="§ 10.1 Extensions to the ServiceWorkerGlobalScope interface">§ 10.1 Extensions to the ServiceWorkerGlobalScope interface</a> </li><li> <a href="#ref-for-dfn-push-subscription-69" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> <a href="#ref-for-dfn-push-subscription-70" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-subscription-71" title="§ 10.5 The pushsubscriptionchange Event">§ 10.5 The pushsubscriptionchange Event</a> <a href="#ref-for-dfn-push-subscription-72" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-subscription-73" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> <a href="#ref-for-dfn-push-subscription-74" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-subscription-75" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-push-endpoint" aria-label="Links in this document to definition: push endpoint"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-push-endpoint" aria-label="Permalink for definition: push endpoint. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-push-endpoint-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dfn-push-endpoint-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-endpoint-3" title="§ 3.4 Push service">§ 3.4 Push service</a> <a href="#ref-for-dfn-push-endpoint-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-endpoint-5" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-push-endpoint-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-endpoint-7" title="§ 5. Push Framework">§ 5. Push Framework</a> <a href="#ref-for-dfn-push-endpoint-8" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-endpoint-9" title="§ 5.3 Push service use">§ 5.3 Push service use</a> <a href="#ref-for-dfn-push-endpoint-10" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-endpoint-11" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-subscription-expiration-time" aria-label="Links in this document to definition: subscription expiration time"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-subscription-expiration-time" aria-label="Permalink for definition: subscription expiration time. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-subscription-expiration-time-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-create-a-push-subscription" aria-label="Links in this document to definition: create a push subscription"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-create-a-push-subscription" aria-label="Permalink for definition: create a push subscription. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-create-a-push-subscription-1" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> </li><li> <a href="#ref-for-dfn-create-a-push-subscription-2" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-refresh" aria-label="Links in this document to definition: refresh"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-refresh" aria-label="Permalink for definition: refresh. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-refresh-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-deactivate" aria-label="Links in this document to definition: deactivated"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-deactivate" aria-label="Permalink for definition: deactivated. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-deactivate-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dfn-deactivate-2" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> </li><li> <a href="#ref-for-dfn-deactivate-3" title="§ 3.3.2 Subscription Deactivation">§ 3.3.2 Subscription Deactivation</a> <a href="#ref-for-dfn-deactivate-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-deactivate-5" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-deactivate-6" title="Reference 2">(2)</a> <a href="#ref-for-dfn-deactivate-7" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-deactivate-8" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dfn-deactivate-9" title="Reference 2">(2)</a> <a href="#ref-for-dfn-deactivate-10" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-push-service" aria-label="Links in this document to definition: push service"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-push-service" aria-label="Permalink for definition: push service. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-push-service-1" title="§ Abstract">§ Abstract</a> <a href="#ref-for-dfn-push-service-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-service-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-service-4" title="§ 1. Introduction">§ 1. Introduction</a> <a href="#ref-for-dfn-push-service-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-service-6" title="Reference 3">(3)</a> <a href="#ref-for-dfn-push-service-7" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dfn-push-service-8" title="§ 2. Dependencies">§ 2. Dependencies</a> </li><li> <a href="#ref-for-dfn-push-service-9" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dfn-push-service-10" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-service-11" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> </li><li> <a href="#ref-for-dfn-push-service-12" title="§ 3.3.2 Subscription Deactivation">§ 3.3.2 Subscription Deactivation</a> </li><li> <a href="#ref-for-dfn-push-service-13" title="§ 3.4 Push service">§ 3.4 Push service</a> <a href="#ref-for-dfn-push-service-14" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-service-15" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-service-16" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-push-service-17" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-service-18" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-service-19" title="§ 5. Push Framework">§ 5. Push Framework</a> <a href="#ref-for-dfn-push-service-20" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-service-21" title="§ 7. PushManager interface">§ 7. PushManager interface</a> <a href="#ref-for-dfn-push-service-22" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-service-23" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> </li><li> <a href="#ref-for-dfn-push-service-24" title="§ 7.2 PushSubscriptionOptions Interface">§ 7.2 PushSubscriptionOptions Interface</a> </li><li> <a href="#ref-for-dfn-push-service-25" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> <a href="#ref-for-dfn-push-service-26" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-service-27" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dfn-push-service-28" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-push-service-29" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> <a href="#ref-for-dfn-push-service-30" title="Reference 2">(2)</a> <a href="#ref-for-dfn-push-service-31" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-push-service-32" title="§ 11. Accessibility">§ 11. Accessibility</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-push" aria-label="Links in this document to definition: &quot;push&quot;"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-push" aria-label="Permalink for definition: &quot;push&quot;. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushpermissiondescriptor" aria-label="Links in this document to definition: PushPermissionDescriptor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushpermissiondescriptor" aria-label="Permalink for definition: PushPermissionDescriptor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushpermissiondescriptor-1" title="§ 3.5 Permission">§ 3.5 Permission</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushpermissiondescriptor-uservisibleonly" aria-label="Links in this document to definition: userVisibleOnly"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushpermissiondescriptor-uservisibleonly" aria-label="Permalink for definition: userVisibleOnly. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1117437819">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushpermissiondescriptor-uservisibleonly-1" title="§ 3.5 Permission">§ 3.5 Permission</a> </li><li> <a href="#ref-for-dom-pushpermissiondescriptor-uservisibleonly-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-ecdh" aria-label="Links in this document to definition: elliptic curve Diffie-Hellman"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-ecdh" aria-label="Permalink for definition: elliptic curve Diffie-Hellman. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-ecdh-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dfn-ecdh-2" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-serviceworkerregistration-pushmanager" aria-label="Links in this document to definition: pushManager"> <span class="caret"></span> <div> <a class="self-link" href="#dom-serviceworkerregistration-pushmanager" aria-label="Permalink for definition: pushManager. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-27231878">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-serviceworkerregistration-pushmanager-1" title="§ 6. Extensions to the ServiceWorkerRegistration Interface">§ 6. Extensions to the ServiceWorkerRegistration Interface</a> </li><li> <a href="#ref-for-dom-serviceworkerregistration-pushmanager-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmanager" aria-label="Links in this document to definition: PushManager"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmanager" aria-label="Permalink for definition: PushManager. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1816674501">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmanager-1" title="§ 6. Extensions to the ServiceWorkerRegistration Interface">§ 6. Extensions to the ServiceWorkerRegistration Interface</a> <a href="#ref-for-dom-pushmanager-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushmanager-3" title="§ 7. PushManager interface">§ 7. PushManager interface</a> <a href="#ref-for-dom-pushmanager-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushmanager-5" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushmanager-6" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmanager-supportedcontentencodings" aria-label="Links in this document to definition: supportedContentEncodings"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmanager-supportedcontentencodings" aria-label="Permalink for definition: supportedContentEncodings. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1816674501">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmanager-supportedcontentencodings-1" title="§ 7. PushManager interface">§ 7. PushManager interface</a> </li><li> <a href="#ref-for-dom-pushmanager-supportedcontentencodings-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmanager-subscribe" aria-label="Links in this document to definition: subscribe()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmanager-subscribe" aria-label="Permalink for definition: subscribe(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1816674501">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmanager-subscribe-1" title="§ 7. PushManager interface">§ 7. PushManager interface</a> </li><li> <a href="#ref-for-dom-pushmanager-subscribe-2" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> </li><li> <a href="#ref-for-dom-pushmanager-subscribe-3" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmanager-getsubscription" aria-label="Links in this document to definition: getSubscription"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmanager-getsubscription" aria-label="Permalink for definition: getSubscription. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1816674501">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmanager-getsubscription-1" title="§ 7. PushManager interface">§ 7. PushManager interface</a> </li><li> <a href="#ref-for-dom-pushmanager-getsubscription-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmanager-permissionstate" aria-label="Links in this document to definition: permissionState()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmanager-permissionstate" aria-label="Permalink for definition: permissionState(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1816674501">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmanager-permissionstate-1" title="§ 7. PushManager interface">§ 7. PushManager interface</a> </li><li> <a href="#ref-for-dom-pushmanager-permissionstate-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionoptions" aria-label="Links in this document to definition: PushSubscriptionOptions"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionoptions" aria-label="Permalink for definition: PushSubscriptionOptions. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1484551711">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionoptions-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-2" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-3" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-4" title="§ 7.2 PushSubscriptionOptions Interface">§ 7.2 PushSubscriptionOptions Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-5" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dom-pushsubscriptionoptions-6" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-7" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushsubscriptionoptions-8" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionoptions-uservisibleonly" aria-label="Links in this document to definition: userVisibleOnly"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionoptions-uservisibleonly" aria-label="Permalink for definition: userVisibleOnly. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1484551711">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionoptions-uservisibleonly-1" title="§ 7.2 PushSubscriptionOptions Interface">§ 7.2 PushSubscriptionOptions Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-uservisibleonly-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionoptions-applicationserverkey" aria-label="Links in this document to definition: applicationServerKey"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionoptions-applicationserverkey" aria-label="Permalink for definition: applicationServerKey. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1484551711">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-2" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-3" title="§ 7.2 PushSubscriptionOptions Interface">§ 7.2 PushSubscriptionOptions Interface</a> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-4" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-5" title="Reference 3">(3)</a> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-6" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-7" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptions-applicationserverkey-8" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionoptionsinit" aria-label="Links in this document to definition: PushSubscriptionOptionsInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionoptionsinit" aria-label="Permalink for definition: PushSubscriptionOptionsInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-975599346">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-2" title="§ 7. PushManager interface">§ 7. PushManager interface</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-4" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-5" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-6" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-8" title="Reference 3">(3)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionoptionsinit-uservisibleonly" aria-label="Links in this document to definition: userVisibleOnly"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionoptionsinit-uservisibleonly" aria-label="Permalink for definition: userVisibleOnly. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-975599346">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-1" title="§ 3.5 Permission">§ 3.5 Permission</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-2" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-4" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-uservisibleonly-5" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionoptionsinit-applicationserverkey" aria-label="Links in this document to definition: applicationServerKey"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionoptionsinit-applicationserverkey" aria-label="Permalink for definition: applicationServerKey. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-975599346">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-1" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-3" title="Reference 3">(3)</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-4" title="Reference 4">(4)</a> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-5" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-6" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> </li><li> <a href="#ref-for-dom-pushsubscriptionoptionsinit-applicationserverkey-7" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription" aria-label="Links in this document to definition: PushSubscription"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription" aria-label="Permalink for definition: PushSubscription. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dom-pushsubscription-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscription-3" title="Reference 3">(3)</a> <a href="#ref-for-dom-pushsubscription-4" title="Reference 4">(4)</a> <a href="#ref-for-dom-pushsubscription-5" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-pushsubscription-6" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> <a href="#ref-for-dom-pushsubscription-7" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscription-8" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-pushsubscription-9" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> </li><li> <a href="#ref-for-dom-pushsubscription-10" title="§ 5.3 Push service use">§ 5.3 Push service use</a> <a href="#ref-for-dom-pushsubscription-11" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscription-12" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-pushsubscription-13" title="§ 7. PushManager interface">§ 7. PushManager interface</a> <a href="#ref-for-dom-pushsubscription-14" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscription-15" title="§ 7.1 subscribe() method">§ 7.1 subscribe() method</a> <a href="#ref-for-dom-pushsubscription-16" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscription-17" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dom-pushsubscription-18" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscription-19" title="Reference 3">(3)</a> <a href="#ref-for-dom-pushsubscription-20" title="Reference 4">(4)</a> <a href="#ref-for-dom-pushsubscription-21" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dom-pushsubscription-22" title="§ 8.1 PushEncryptionKeyName enumeration">§ 8.1 PushEncryptionKeyName enumeration</a> </li><li> <a href="#ref-for-dom-pushsubscription-23" title="§ 10.5.1 PushSubscriptionChangeEvent Interface">§ 10.5.1 PushSubscriptionChangeEvent Interface</a> <a href="#ref-for-dom-pushsubscription-24" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscription-25" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> <a href="#ref-for-dom-pushsubscription-26" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscription-27" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushsubscription-28" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscription-29" title="Reference 3">(3)</a> <a href="#ref-for-dom-pushsubscription-30" title="Reference 4">(4)</a> <a href="#ref-for-dom-pushsubscription-31" title="Reference 5">(5)</a> <a href="#ref-for-dom-pushsubscription-32" title="Reference 6">(6)</a> <a href="#ref-for-dom-pushsubscription-33" title="Reference 7">(7)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription-endpoint" aria-label="Links in this document to definition: endpoint"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription-endpoint" aria-label="Permalink for definition: endpoint. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-endpoint-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription-expirationtime" aria-label="Links in this document to definition: expirationTime"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription-expirationtime" aria-label="Permalink for definition: expirationTime. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-expirationtime-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionjson-endpoint" aria-label="Links in this document to definition: endpoint"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionjson-endpoint" aria-label="Permalink for definition: endpoint. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionjson-expirationtime" aria-label="Links in this document to definition: expirationTime"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionjson-expirationtime" aria-label="Permalink for definition: expirationTime. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-getting-the-endpoint-attribute" aria-label="Links in this document to definition: getting the endpoint attribute"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-getting-the-endpoint-attribute" aria-label="Permalink for definition: getting the endpoint attribute. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-getting-the-endpoint-attribute-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-getting-the-expirationtime-attribute" aria-label="Links in this document to definition: getting the expirationTime attribute"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-getting-the-expirationtime-attribute" aria-label="Permalink for definition: getting the expirationTime attribute. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-getting-the-expirationtime-attribute-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription-options" aria-label="Links in this document to definition: options"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription-options" aria-label="Permalink for definition: options. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-options-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dom-pushsubscription-options-2" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dom-pushsubscription-options-3" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription-getkey" aria-label="Links in this document to definition: getKey()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription-getkey" aria-label="Permalink for definition: getKey(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-getkey-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dom-pushsubscription-getkey-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushsubscription-getkey-3" title="§ 5.3 Push service use">§ 5.3 Push service use</a> </li><li> <a href="#ref-for-dom-pushsubscription-getkey-4" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dom-pushsubscription-getkey-5" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscription-getkey-6" title="Reference 3">(3)</a> <a href="#ref-for-dom-pushsubscription-getkey-7" title="Reference 4">(4)</a> </li><li> <a href="#ref-for-dom-pushsubscription-getkey-8" title="§ 8.1 PushEncryptionKeyName enumeration">§ 8.1 PushEncryptionKeyName enumeration</a> </li><li> <a href="#ref-for-dom-pushsubscription-getkey-9" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription-unsubscribe" aria-label="Links in this document to definition: unsubscribe()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription-unsubscribe" aria-label="Permalink for definition: unsubscribe(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-unsubscribe-1" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> </li><li> <a href="#ref-for-dom-pushsubscription-unsubscribe-2" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dom-pushsubscription-unsubscribe-3" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscription-tojson" aria-label="Links in this document to definition: toJSON()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscription-tojson" aria-label="Permalink for definition: toJSON(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscription-tojson-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dom-pushsubscription-tojson-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionjson" aria-label="Links in this document to definition: PushSubscriptionJSON"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionjson" aria-label="Permalink for definition: PushSubscriptionJSON. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionjson-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dom-pushsubscriptionjson-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushsubscriptionjson-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-pushsubscriptionjson-4" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushsubscriptionjson-5" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionjson-keys" aria-label="Links in this document to definition: keys"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionjson-keys" aria-label="Permalink for definition: keys. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1348261679">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionjson-keys-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionjson-keys-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushencryptionkeyname" aria-label="Links in this document to definition: PushEncryptionKeyName"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushencryptionkeyname" aria-label="Permalink for definition: PushEncryptionKeyName. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-226775330">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushencryptionkeyname-1" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dom-pushencryptionkeyname-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-3" title="§ 8.1 PushEncryptionKeyName enumeration">§ 8.1 PushEncryptionKeyName enumeration</a> <a href="#ref-for-dom-pushencryptionkeyname-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-5" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushencryptionkeyname-6" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushencryptionkeyname-p256dh" aria-label="Links in this document to definition: p256dh"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushencryptionkeyname-p256dh" aria-label="Permalink for definition: p256dh. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-226775330">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushencryptionkeyname-p256dh-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-p256dh-2" title="§ 5.3 Push service use">§ 5.3 Push service use</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-p256dh-3" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dom-pushencryptionkeyname-p256dh-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-p256dh-5" title="§ 8.1 PushEncryptionKeyName enumeration">§ 8.1 PushEncryptionKeyName enumeration</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-p256dh-6" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushencryptionkeyname-auth" aria-label="Links in this document to definition: auth"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushencryptionkeyname-auth" aria-label="Permalink for definition: auth. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-226775330">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushencryptionkeyname-auth-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-auth-2" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-auth-3" title="§ 8.1 PushEncryptionKeyName enumeration">§ 8.1 PushEncryptionKeyName enumeration</a> </li><li> <a href="#ref-for-dom-pushencryptionkeyname-auth-4" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedata" aria-label="Links in this document to definition: PushMessageData"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedata" aria-label="Permalink for definition: PushMessageData. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1430759589">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedata-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> <a href="#ref-for-dom-pushmessagedata-2" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushmessagedata-3" title="§ 10.2 PushEvent Interface">§ 10.2 PushEvent Interface</a> <a href="#ref-for-dom-pushmessagedata-4" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dom-pushmessagedata-5" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> </li><li> <a href="#ref-for-dom-pushmessagedata-6" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushmessagedata-7" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-bytes" aria-label="Links in this document to definition: bytes"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-bytes" aria-label="Permalink for definition: bytes. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-bytes-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> <a href="#ref-for-dfn-bytes-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-bytes-3" title="Reference 3">(3)</a> <a href="#ref-for-dfn-bytes-4" title="Reference 4">(4)</a> <a href="#ref-for-dfn-bytes-5" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-bytes-6" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedata-arraybuffer" aria-label="Links in this document to definition: arrayBuffer()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedata-arraybuffer" aria-label="Permalink for definition: arrayBuffer(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1430759589">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedata-arraybuffer-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> </li><li> <a href="#ref-for-dom-pushmessagedata-arraybuffer-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedata-blob" aria-label="Links in this document to definition: blob()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedata-blob" aria-label="Permalink for definition: blob(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1430759589">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedata-blob-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> </li><li> <a href="#ref-for-dom-pushmessagedata-blob-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedata-bytes" aria-label="Links in this document to definition: bytes()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedata-bytes" aria-label="Permalink for definition: bytes(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1430759589">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedata-bytes-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> </li><li> <a href="#ref-for-dom-pushmessagedata-bytes-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedata-json" aria-label="Links in this document to definition: json()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedata-json" aria-label="Permalink for definition: json(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1430759589">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedata-json-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> </li><li> <a href="#ref-for-dom-pushmessagedata-json-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedata-text" aria-label="Links in this document to definition: text()"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedata-text" aria-label="Permalink for definition: text(). Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1430759589">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedata-text-1" title="§ 9. PushMessageData interface">§ 9. PushMessageData interface</a> </li><li> <a href="#ref-for-dom-pushmessagedata-text-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-extract-a-byte-sequence" aria-label="Links in this document to definition: extract a byte sequence"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-extract-a-byte-sequence" aria-label="Permalink for definition: extract a byte sequence. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-extract-a-byte-sequence-1" title="§ 10.2 PushEvent Interface">§ 10.2 PushEvent Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-serviceworkerglobalscope-onpush" aria-label="Links in this document to definition: onpush"> <span class="caret"></span> <div> <a class="self-link" href="#dom-serviceworkerglobalscope-onpush" aria-label="Permalink for definition: onpush. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-801193280">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-serviceworkerglobalscope-onpush-1" title="§ 10.1 Extensions to the ServiceWorkerGlobalScope interface">§ 10.1 Extensions to the ServiceWorkerGlobalScope interface</a> </li><li> <a href="#ref-for-dom-serviceworkerglobalscope-onpush-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-serviceworkerglobalscope-onpushsubscriptionchange" aria-label="Links in this document to definition: onpushsubscriptionchange"> <span class="caret"></span> <div> <a class="self-link" href="#dom-serviceworkerglobalscope-onpushsubscriptionchange" aria-label="Permalink for definition: onpushsubscriptionchange. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-801193280">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-serviceworkerglobalscope-onpushsubscriptionchange-1" title="§ 10.1 Extensions to the ServiceWorkerGlobalScope interface">§ 10.1 Extensions to the ServiceWorkerGlobalScope interface</a> </li><li> <a href="#ref-for-dom-serviceworkerglobalscope-onpushsubscriptionchange-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushevent" aria-label="Links in this document to definition: PushEvent"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushevent" aria-label="Permalink for definition: PushEvent. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-302405565">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushevent-1" title="§ 10.2 PushEvent Interface">§ 10.2 PushEvent Interface</a> <a href="#ref-for-dom-pushevent-2" title="Reference 2">(2)</a> <a href="#ref-for-dom-pushevent-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dom-pushevent-4" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> </li><li> <a href="#ref-for-dom-pushevent-5" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushevent-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushevent-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-302405565">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushevent-constructor-1" title="§ 10.2 PushEvent Interface">§ 10.2 PushEvent Interface</a> </li><li> <a href="#ref-for-dom-pushevent-constructor-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushevent-data" aria-label="Links in this document to definition: data"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushevent-data" aria-label="Permalink for definition: data. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-302405565">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushevent-data-1" title="§ 10.2 PushEvent Interface">§ 10.2 PushEvent Interface</a> </li><li> <a href="#ref-for-dom-pushevent-data-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pusheventinit" aria-label="Links in this document to definition: PushEventInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pusheventinit" aria-label="Permalink for definition: PushEventInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-173618782">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pusheventinit-1" title="§ 10.2 PushEvent Interface">§ 10.2 PushEvent Interface</a> </li><li> <a href="#ref-for-dom-pusheventinit-2" title="§ 10.3 PushEventInit dictionary">§ 10.3 PushEventInit dictionary</a> </li><li> <a href="#ref-for-dom-pusheventinit-3" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pusheventinit-4" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushmessagedatainit" aria-label="Links in this document to definition: PushMessageDataInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushmessagedatainit" aria-label="Permalink for definition: PushMessageDataInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushmessagedatainit-1" title="§ 10.3 PushEventInit dictionary">§ 10.3 PushEventInit dictionary</a> </li><li> <a href="#ref-for-dom-pushmessagedatainit-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pusheventinit-data" aria-label="Links in this document to definition: data"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pusheventinit-data" aria-label="Permalink for definition: data. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-173618782">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pusheventinit-data-1" title="§ 10.3 PushEventInit dictionary">§ 10.3 PushEventInit dictionary</a> </li><li> <a href="#ref-for-dom-pusheventinit-data-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-pushsubscriptionchange" aria-label="Links in this document to definition: pushsubscriptionchange"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-pushsubscriptionchange" aria-label="Permalink for definition: pushsubscriptionchange. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-pushsubscriptionchange-1" title="§ 10.5 The pushsubscriptionchange Event">§ 10.5 The pushsubscriptionchange Event</a> </li><li> <a href="#ref-for-dfn-pushsubscriptionchange-2" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-fire-the-pushsubscriptionchange-event" aria-label="Links in this document to definition: fire the &quot;pushsubscriptionchange&quot; event"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-fire-the-pushsubscriptionchange-event" aria-label="Permalink for definition: fire the &quot;pushsubscriptionchange&quot; event. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-fire-the-pushsubscriptionchange-event-1" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> </li><li> <a href="#ref-for-dfn-fire-the-pushsubscriptionchange-event-2" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> <a href="#ref-for-dfn-fire-the-pushsubscriptionchange-event-3" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-fire-the-pushsubscriptionchange-event-4" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeevent" aria-label="Links in this document to definition: PushSubscriptionChangeEvent"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeevent" aria-label="Permalink for definition: PushSubscriptionChangeEvent. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2104077905">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionchangeevent-1" title="§ 10.5 The pushsubscriptionchange Event">§ 10.5 The pushsubscriptionchange Event</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeevent-2" title="§ 10.5.1 PushSubscriptionChangeEvent Interface">§ 10.5.1 PushSubscriptionChangeEvent Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeevent-3" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeevent-constructor" aria-label="Links in this document to definition: constructor"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeevent-constructor" aria-label="Permalink for definition: constructor. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> </div> <p><b>Referenced in:</b></p> <ul> <li>Not referenced in this document.</li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeevent-newsubscription" aria-label="Links in this document to definition: newSubscription"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeevent-newsubscription" aria-label="Permalink for definition: newSubscription. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2104077905">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionchangeevent-newsubscription-1" title="§ 10.5.1 PushSubscriptionChangeEvent Interface">§ 10.5.1 PushSubscriptionChangeEvent Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeevent-newsubscription-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeevent-oldsubscription" aria-label="Links in this document to definition: oldSubscription"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeevent-oldsubscription" aria-label="Permalink for definition: oldSubscription. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-2104077905">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionchangeevent-oldsubscription-1" title="§ 10.5.1 PushSubscriptionChangeEvent Interface">§ 10.5.1 PushSubscriptionChangeEvent Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeevent-oldsubscription-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeeventinit" aria-label="Links in this document to definition: PushSubscriptionChangeEventInit"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeeventinit" aria-label="Permalink for definition: PushSubscriptionChangeEventInit. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1842180883">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-1" title="§ 10.5.1 PushSubscriptionChangeEvent Interface">§ 10.5.1 PushSubscriptionChangeEvent Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-2" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-3" title="§ A. IDL Index">§ A. IDL Index</a> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-4" title="Reference 2">(2)</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeeventinit-newsubscription" aria-label="Links in this document to definition: newSubscription"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeeventinit-newsubscription" aria-label="Permalink for definition: newSubscription. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1842180883">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-newsubscription-1" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-newsubscription-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dom-pushsubscriptionchangeeventinit-oldsubscription" aria-label="Links in this document to definition: oldSubscription"> <span class="caret"></span> <div> <a class="self-link" href="#dom-pushsubscriptionchangeeventinit-oldsubscription" aria-label="Permalink for definition: oldSubscription. Activate to close this dialog.">Permalink</a> <span class="marker dfn-exported" title="Definition can be referenced by other specifications">exported</span> <a class="marker idl-block" title="Jump to IDL declaration" href="#webidl-1842180883">IDL</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-oldsubscription-1" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> </li><li> <a href="#ref-for-dom-pushsubscriptionchangeeventinit-oldsubscription-2" title="§ A. IDL Index">§ A. IDL Index</a> </li> </ul> </div><div class="dfn-panel" hidden="" role="dialog" aria-modal="true" id="dfn-panel-for-dfn-user-agent" aria-label="Links in this document to definition: user agent"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-user-agent" aria-label="Permalink for definition: user agent. Activate to close this dialog.">Permalink</a> </div> <p><b>Referenced in:</b></p> <ul> <li> <a href="#ref-for-dfn-user-agent-1" title="§ Abstract">§ Abstract</a> <a href="#ref-for-dfn-user-agent-2" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-3" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-user-agent-4" title="§ 1. Introduction">§ 1. Introduction</a> <a href="#ref-for-dfn-user-agent-5" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-6" title="Reference 3">(3)</a> <a href="#ref-for-dfn-user-agent-7" title="Reference 4">(4)</a> <a href="#ref-for-dfn-user-agent-8" title="Reference 5">(5)</a> <a href="#ref-for-dfn-user-agent-9" title="Reference 6">(6)</a> <a href="#ref-for-dfn-user-agent-10" title="Reference 7">(7)</a> <a href="#ref-for-dfn-user-agent-11" title="Reference 8">(8)</a> <a href="#ref-for-dfn-user-agent-12" title="Reference 9">(9)</a> </li><li> <a href="#ref-for-dfn-user-agent-13" title="§ 2. Dependencies">§ 2. Dependencies</a> </li><li> <a href="#ref-for-dfn-user-agent-14" title="§ 3.3 Push subscription">§ 3.3 Push subscription</a> <a href="#ref-for-dfn-user-agent-15" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-16" title="Reference 3">(3)</a> </li><li> <a href="#ref-for-dfn-user-agent-17" title="§ 3.3.1 Subscription Refreshes">§ 3.3.1 Subscription Refreshes</a> <a href="#ref-for-dfn-user-agent-18" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-19" title="Reference 3">(3)</a> <a href="#ref-for-dfn-user-agent-20" title="Reference 4">(4)</a> <a href="#ref-for-dfn-user-agent-21" title="Reference 5">(5)</a> <a href="#ref-for-dfn-user-agent-22" title="Reference 6">(6)</a> </li><li> <a href="#ref-for-dfn-user-agent-23" title="§ 3.3.2 Subscription Deactivation">§ 3.3.2 Subscription Deactivation</a> </li><li> <a href="#ref-for-dfn-user-agent-24" title="§ 3.4 Push service">§ 3.4 Push service</a> <a href="#ref-for-dfn-user-agent-25" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-user-agent-26" title="§ 4. Security and privacy considerations">§ 4. Security and privacy considerations</a> <a href="#ref-for-dfn-user-agent-27" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-28" title="Reference 3">(3)</a> <a href="#ref-for-dfn-user-agent-29" title="Reference 4">(4)</a> <a href="#ref-for-dfn-user-agent-30" title="Reference 5">(5)</a> <a href="#ref-for-dfn-user-agent-31" title="Reference 6">(6)</a> <a href="#ref-for-dfn-user-agent-32" title="Reference 7">(7)</a> <a href="#ref-for-dfn-user-agent-33" title="Reference 8">(8)</a> </li><li> <a href="#ref-for-dfn-user-agent-34" title="§ 5. Push Framework">§ 5. Push Framework</a> <a href="#ref-for-dfn-user-agent-35" title="Reference 2">(2)</a> </li><li> <a href="#ref-for-dfn-user-agent-36" title="§ 7. PushManager interface">§ 7. PushManager interface</a> </li><li> <a href="#ref-for-dfn-user-agent-37" title="§ 7.3 PushSubscriptionOptionsInit dictionary">§ 7.3 PushSubscriptionOptionsInit dictionary</a> <a href="#ref-for-dfn-user-agent-38" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-39" title="Reference 3">(3)</a> <a href="#ref-for-dfn-user-agent-40" title="Reference 4">(4)</a> <a href="#ref-for-dfn-user-agent-41" title="Reference 5">(5)</a> </li><li> <a href="#ref-for-dfn-user-agent-42" title="§ 8. PushSubscription interface">§ 8. PushSubscription interface</a> <a href="#ref-for-dfn-user-agent-43" title="Reference 2">(2)</a> <a href="#ref-for-dfn-user-agent-44" title="Reference 3">(3)</a> <a href="#ref-for-dfn-user-agent-45" title="Reference 4">(4)</a> <a href="#ref-for-dfn-user-agent-46" title="Reference 5">(5)</a> <a href="#ref-for-dfn-user-agent-47" title="Reference 6">(6)</a> <a href="#ref-for-dfn-user-agent-48" title="Reference 7">(7)</a> <a href="#ref-for-dfn-user-agent-49" title="Reference 8">(8)</a> </li><li> <a href="#ref-for-dfn-user-agent-50" title="§ 10.3 PushEventInit dictionary">§ 10.3 PushEventInit dictionary</a> </li><li> <a href="#ref-for-dfn-user-agent-51" title="§ 10.4 Receiving a Push Message">§ 10.4 Receiving a Push Message</a> </li><li> <a href="#ref-for-dfn-user-agent-52" title="§ 10.5 The pushsubscriptionchange Event">§ 10.5 The pushsubscriptionchange Event</a> </li><li> <a href="#ref-for-dfn-user-agent-53" title="§ 10.5.2 PushSubscriptionChangeEventInit Interface">§ 10.5.2 PushSubscriptionChangeEventInit Interface</a> </li> </ul> </div><script id="respec-dfn-panel">(() => { // @ts-check if (document.respec) { document.respec.ready.then(setupPanel); } else { setupPanel(); } function setupPanel() { const listener = panelListener(); document.body.addEventListener("keydown", listener); document.body.addEventListener("click", listener); } function panelListener() { /** @type {HTMLElement} */ let panel = null; return event => { const { target, type } = event; if (!(target instanceof HTMLElement)) return; // For keys, we only care about Enter key to activate the panel // otherwise it's activated via a click. if (type === "keydown" && event.key !== "Enter") return; const action = deriveAction(event); switch (action) { case "show": { hidePanel(panel); /** @type {HTMLElement} */ const dfn = target.closest("dfn, .index-term"); panel = document.getElementById(`dfn-panel-for-${dfn.id}`); const coords = deriveCoordinates(event); displayPanel(dfn, panel, coords); break; } case "dock": { panel.style.left = null; panel.style.top = null; panel.classList.add("docked"); break; } case "hide": { hidePanel(panel); panel = null; break; } } }; } /** * @param {MouseEvent|KeyboardEvent} event */ function deriveCoordinates(event) { const target = /** @type HTMLElement */ (event.target); // We prevent synthetic AT clicks from putting // the dialog in a weird place. The AT events sometimes // lack coordinates, so they have clientX/Y = 0 const rect = target.getBoundingClientRect(); if ( event instanceof MouseEvent && event.clientX >= rect.left && event.clientY >= rect.top ) { // The event probably happened inside the bounding rect... return { x: event.clientX, y: event.clientY }; } // Offset to the middle of the element const x = rect.x + rect.width / 2; // Placed at the bottom of the element const y = rect.y + rect.height; return { x, y }; } /** * @param {Event} event */ function deriveAction(event) { const target = /** @type {HTMLElement} */ (event.target); const hitALink = !!target.closest("a"); if (target.closest("dfn:not([data-cite]), .index-term")) { return hitALink ? "none" : "show"; } if (target.closest(".dfn-panel")) { if (hitALink) { return target.classList.contains("self-link") ? "hide" : "dock"; } const panel = target.closest(".dfn-panel"); return panel.classList.contains("docked") ? "hide" : "none"; } if (document.querySelector(".dfn-panel:not([hidden])")) { return "hide"; } return "none"; } /** * @param {HTMLElement} dfn * @param {HTMLElement} panel * @param {{ x: number, y: number }} clickPosition */ function displayPanel(dfn, panel, { x, y }) { panel.hidden = false; // distance (px) between edge of panel and the pointing triangle (caret) const MARGIN = 20; const dfnRects = dfn.getClientRects(); // Find the `top` offset when the `dfn` can be spread across multiple lines let closestTop = 0; let minDiff = Infinity; for (const rect of dfnRects) { const { top, bottom } = rect; const diffFromClickY = Math.abs((top + bottom) / 2 - y); if (diffFromClickY < minDiff) { minDiff = diffFromClickY; closestTop = top; } } const top = window.scrollY + closestTop + dfnRects[0].height; const left = x - MARGIN; panel.style.left = `${left}px`; panel.style.top = `${top}px`; // Find if the panel is flowing out of the window const panelRect = panel.getBoundingClientRect(); const SCREEN_WIDTH = Math.min(window.innerWidth, window.screen.width); if (panelRect.right > SCREEN_WIDTH) { const newLeft = Math.max(MARGIN, x + MARGIN - panelRect.width); const newCaretOffset = left - newLeft; panel.style.left = `${newLeft}px`; /** @type {HTMLElement} */ const caret = panel.querySelector(".caret"); caret.style.left = `${newCaretOffset}px`; } // As it's a dialog, we trap focus. // TODO: when <dialog> becomes a implemented, we should really // use that. trapFocus(panel, dfn); } /** * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function trapFocus(panel, dfn) { /** @type NodeListOf<HTMLAnchorElement> elements */ const anchors = panel.querySelectorAll("a[href]"); // No need to trap focus if (!anchors.length) return; // Move focus to first anchor element const first = anchors.item(0); first.focus(); const trapListener = createTrapListener(anchors, panel, dfn); panel.addEventListener("keydown", trapListener); // Hiding the panel releases the trap const mo = new MutationObserver(records => { const [record] = records; const target = /** @type HTMLElement */ (record.target); if (target.hidden) { panel.removeEventListener("keydown", trapListener); mo.disconnect(); } }); mo.observe(panel, { attributes: true, attributeFilter: ["hidden"] }); } /** * * @param {NodeListOf<HTMLAnchorElement>} anchors * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function createTrapListener(anchors, panel, dfn) { const lastIndex = anchors.length - 1; let currentIndex = 0; return event => { switch (event.key) { // Hitting "Tab" traps us in a nice loop around elements. case "Tab": { event.preventDefault(); currentIndex += event.shiftKey ? -1 : +1; if (currentIndex < 0) { currentIndex = lastIndex; } else if (currentIndex > lastIndex) { currentIndex = 0; } anchors.item(currentIndex).focus(); break; } // Hitting "Enter" on an anchor releases the trap. case "Enter": hidePanel(panel); break; // Hitting "Escape" returns focus to dfn. case "Escape": hidePanel(panel); dfn.focus(); return; } }; } /** @param {HTMLElement} panel */ function hidePanel(panel) { if (!panel) return; panel.hidden = true; panel.classList.remove("docked"); } })()</script><script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10