Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web SDK API for service worker to be updated manually #113

Closed
3 tasks
jasonpang opened this issue Aug 22, 2016 · 2 comments
Closed
3 tasks

Add web SDK API for service worker to be updated manually #113

jasonpang opened this issue Aug 22, 2016 · 2 comments

Comments

@jasonpang
Copy link
Contributor

jasonpang commented Aug 22, 2016

Users that import their service worker into ours lose the ability to update their service worker.

The update algorithm of the service worker checks for byte-differences in the service worker's script but it doesn't use the contents of imported scripts (imported via importScript(..)) to be part of that check. This is kind of an issue because it means the service worker will never update if we have two importScript(..) statements. Our workaround for this issue has been to register a new service worker over the existing one, which updates the service worker (we do not unregister the previous one before registering the new one, we only register the new one, as unregistering the previous worker also unsubscribes the user from push notifications). We do not register a new service worker every time for performance reasons; we only register a new service worker anytime the version number of our SDK changes (which is infrequently, but once a week or once every two weeks).

The service worker update behavior is intended to change to also check the contents of imported scripts. See here.

  • Make OneSignal._updateServiceWorker() public (and remove the _)
  • Allow it to take a {force: true} parameter
  • Miscellaneous: Combine usages of OneSignal.VERSION and OneSignal._VERSION
@jasonpang jasonpang added this to the September 2016 Web Push Fixes milestone Sep 15, 2016
@jasonpang jasonpang removed this from the October 2016 Web Push Fixes milestone Oct 10, 2016
@jasonpang
Copy link
Contributor Author

This is now tracked internally.

@pekq
Copy link

pekq commented Mar 22, 2018

What's the situation on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants