title: How to get registration id in push event in ServiceWorker?
body: <p>I have the registration id when subscribing, but I can't figure out how to get it in the service worker file when I get the push notification?</p>
  
  <p><strong>client.js</strong></p>
  
  <pre><code>pushManager.subscribe({ userVisibleOnly: true }).then(({ endpoint }) =&gt; {
    const registrationId = endpoint.split('https://android.googleapis.com/gcm/send/')[1];
    // How do I get this registrationId in service-worker.js below?  
  });
  </code></pre>
  
  <p><strong>service-worker.js</strong></p>
  
  <pre><code>self.addEventListener('push', event =&gt; {
    // I'd like to make a request to server to get the notification data, but I need the registrationId for that. How do I get registration id here?
  });
  </code></pre>