0
votes

I've just installed firebase in my app. So I registered service workers for tens of thousands of users to receive background notifications. How can I update all of them?

The problems why I want to update them:

  • I have hardcoded notification icon in service worker and now I want to get it from payload
  • I changed api version, now passing parameters in payload.data.title instead of payload.json.title

Can I update already registered service workers?

1

1 Answers

1
votes

Service Workers are updated according to their update lifecycle (see docs here). Specifically from the docs, a service worker is updated when any of these happen:

  • A navigation to an in-scope page.
  • A functional events such as push and sync, unless there's been an update check within the previous 24 hours.
  • Calling .register() only if the service worker URL has changed. However, you should avoid changing the worker URL.