importScripts('https://www.gstatic.com/firebasejs/8.4.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.4.1/firebase-messaging.js');

   /*Update with yours config*/
  const firebaseConfig = {
    apiKey: "AIzaSyDlJQaEV9aPnPFeFA7QeiVijoGZXqemCRw",
    authDomain: "telmessenger-d3935.firebaseapp.com",
    databaseURL: "https://telmessenger-d3935.firebaseio.com",
    projectId: "telmessenger-d3935",
    storageBucket: "telmessenger-d3935.appspot.com",
    messagingSenderId: "647562261340",
    appId: "1:647562261340:web:01b97a27460e4bfd5b0799",
    measurementId: "G-BFCBWCK70H"
  };
  firebase.initializeApp(firebaseConfig);
  const messaging = firebase.messaging();

  /*messaging.onMessage((payload) => {
  console.log('Message received. ', payload);*/
  messaging.onBackgroundMessage(function(payload) {
    console.log('Received background message ', payload);

    const notificationTitle = payload.notification.title;
    const notificationOptions = {
      body: payload.notification.body,
    };

    self.registration.showNotification(notificationTitle,
      notificationOptions);
  });
