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

Realtime update #2

Closed
knownasilya opened this issue Mar 8, 2018 · 5 comments
Closed

Realtime update #2

knownasilya opened this issue Mar 8, 2018 · 5 comments

Comments

@knownasilya
Copy link

Service workers install in realtime (I think), so this update should be realtime as well.
This will urge users to not work with a outdated app and prevent errors/bugs.

@topaxi
Copy link
Owner

topaxi commented Mar 10, 2018

This is a nice idea, I'm not 100% familiar when ServiceWorkers rerequests the service worker file. From my experience, Android does seem to rerequest the service worker on PWA (add-to-homescreen) Apps once you reopen them. I'm not 100% sure on this one thought. Once a new tab with the App is opened, outdated tabs should definitely get the notification. Would be interesting to implement a strategy that periodically checks the service worker file or even via push notification (I don't have any experience with ServiceWorker push features, I think they would need some kind of external service like Google?).

Do you think that it would be enough to implement an API to trigger the notification of this addon and implement the check for updates in a additional one?

@NullVoxPopuli
Copy link
Collaborator

I think having a way to maybe check for an update once every 10 minutes would be really cool.

@topaxi
Copy link
Owner

topaxi commented May 24, 2018

@NullVoxPopuli you should be easily able to do this without any addons or APIs. To check for an update all you need to do is:

navigator.serviceWorker.getRegistration().then(registration => registration.update());

@NullVoxPopuli
Copy link
Collaborator

so, this is probably my lack of understanding of this addon and service workers in general, but
I added this

    setInterval(() => {
      navigator.serviceWorker.getRegistration()
        .then(registration => registration && registration.update());
    }, 60000);

to the application route's activate hook.

I only ever see the update notification appear immediately after clicking refresh (but right before the page actually refreshes)

@NullVoxPopuli
Copy link
Collaborator

Hopefully #3 resolves this

@topaxi topaxi closed this as completed in #3 Nov 28, 2018
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