title: How to use service worker with FCM for Push Notifications
body: <p>I am trying to use service worker with Firebase to implement push notifications on chrome. I have a manifest file and an sw.js file in my web app. I have created a project in Firebase and I have tested registering and sending notifications. this all works fine except that when receiving the notifications the data is null. I don't understand why and there aren't any helpful resources (to my knowledge!). 
  Here is my service worker file:</p>
  
  <pre><code>self.addEventListener('push', function(event) {
    console.log('Push message', event);
    var title = 'Push message';
    event.waitUntil(
      self.registration.showNotification(title, {
        body: 'The Message',
        icon: 'images/logo.svg',
        tag: 'my-tag'
    }));
  });
  </code></pre>
  
  <p>Here is my main.js file:</p>
  
  <pre><code>if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/sw.js').then(function(registration) {
      // Registration was successful
      console.log('ServiceWorker registration successful with scope: ',    registration.scope);
      registration.pushManager.subscribe({
        userVisibleOnly: true
      }).then(function(sub) {
        console.log('endpoint:', sub.endpoint);
      }).catch(function(e) {
  
      });
    }).catch(function(err) {
      // registration failed :(
      console.log('ServiceWorker registration failed: ', err);
    });
  }
  </code></pre>
  
  <p>Manifest.json:</p>
  
  <pre><code>{
    "name": "APPNAME",
    "gcm_sender_id": "SENDERID"
  }
  </code></pre>
  
  <p>cURL Request:</p>
  
  <pre><code>curl --header "Authorization: key=APIKEY" -application/json" https://fcm.googleapis.com/fcm/send -d "{\"registration_ids\":[\"REGISTRATIONID\"],\"notification\":{\"title\":\"test\",\"body\":\"testing\"},\"data\":{\"title\":\"erse\"}}"
  </code></pre>
  
  <p>Console log of push event from sw.js:
  <a href="https://i.stack.imgur.com/dyVoD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dyVoD.png" alt="enter image description here"></a></p>
  
  <p>I am not receiving any of the data I sent in the request. Is this done some other way with firebase? 
  Thanks in advance.</p>