5

I am able to successfully get push notification from my server and update react component with this

    self.addEventListener('push', event => {
     const data = event.data.json();
     event.waitUntil(
       self.registration.showNotification(data.title, {
         body: data.body,
         image: './Flowster-icon-32.png'
      })
    );

     const channel = new BroadcastChannel('sw-messages');
     channel.postMessage(data);
   });

But browser sucs IE, safari, donto support BroadcastChannel, even client.postMessage is not supported in these browser, how can i make it work in those browser. Thanks for the help in advance.

naruto
  • 327
  • 1
  • 11

1 Answers1

0

Since the BroadcastChannel doesn't support IE and safari browser, as a workaround, I suggest you could try to use the sysend.js in IE or safari browser.

Reference: How can I use the BroadcastChannel API or something similar in Safari 10+?

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30