How to push data to a manifest v3 browser extension in Edge?

Peter Bloomfield 1 Reputation point
2022-06-30T15:08:33.267+00:00

We maintain a few browser extensions which currently rely on long-running connections to our cloud services to receive real-time data. In manifest v3 extensions, long-running connections no longer work because the service worker can be shut down regularly by the browser. As an alternative, is there some way that our cloud service could push data or notifications to the extension, such that the service worker will be activated (if necessary) to handle it?

We've tried looking at the Web Push API, but it doesn't seem to be available from within an extension service worker.

For comparison, we've solved this on our Chrome extension by using Firebase messaging. However, the necessary chrome.gcm.* API isn't available in Edge. Is there an alternative we could use?

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,238 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yu Zhou-MSFT 12,951 Reputation points Microsoft Vendor
    2022-07-01T09:13:42.127+00:00

    Hi @Peter Bloomfield

    According to Microsoft official demo: "Microsoft Edge relies on the Windows Push Notification Service (WNS) to deliver push messages". So you need to use Windows Push Notification Service in Edge, just like Firebase Cloud Messaging in Chrome.
    For more information of WNS, please read this doc.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Regards,
    Yu Zhou


  2. Yu Zhou-MSFT 12,951 Reputation points Microsoft Vendor
    2022-07-12T07:11:01.387+00:00

    Hi @Peter Bloomfield

    I have checked the document, but unfortunately it is not for extension service workers. I have re-evaluated this issue, and the trouble lies in the shut down service worker. It is a known issue in Manifest V3 that service worker is shut down every 5 minutes, but haven't been solved yet. However, here's a workaround for you. If you use ports e.g. chrome.runtime.connect, just reconnect each port before 5 minutes elapse. You can refer to this thread and scroll down to If you already use ports e.g. chrome.runtime.connect to check the workaround.

    0 comments No comments