-
Notifications
You must be signed in to change notification settings - Fork 84
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
Allow use of Background Sync with the Push API (when no window is opened) #147
Comments
Pushsubscriptionchange won't trigger when a service worker is not running. That event is not able to wake the sw up. |
Having that service working running is something different from having a window attached to it. Example: a service worker wakes up for a |
That is true. Regarding your example. There won't be a push event fired if the subscription was made invalid before. With an invalid subscription you weren't able to push in the first place. Meaning the sw won't wake up to trigger pushsubchange. |
No, I think that there is a grace period during which the old subscription is still valid. Also consider this:
Finally the service worker in the future will be activated in background for many different things and this will cause problems and random failures (difficult to debug!) if you can't always use |
I really don't think there is one but I could be wrong. What you outline could in theory be possible I guess. But I think it's very unlikely that a push happens and in the next minute subscription changes. I have no idea where this service worker thing is going I only started looking into it recently. |
It's very unlikely means "very difficult to debug" and "unreliable technology". Also note that the aim of sync is to create a reliable technology... otherwise you can just avoid to use sync and make network calls directly. Also it is not so unlikely since I think that a grace period exists and that the subscription can be replaced now, when the browser is activated, even if the subscription had expired hours or days before. |
I am not familiar with the spec where do you get it from that there is a grace period? And how would it work? I only played with chrome and saw that if you unregister the subscription or the service worker you cannot push anymore to it. |
@h43z Sorry, we are going off topic here... you can check the spec for more information. The point is that
In both cases the |
|
@jkarlin Ok, but then you should coordinate your thought with the people who is writing the Push API. It doesn't make sense that they suggest to do something that doesn't work. At least if you clearly reject this use case, they will have to find another solution for the Push API. |
This is really important... you don't know how many times subscription are lost due to subscription refresh + network failure. Basically you subscribe to a website and then after some time the notifications stop working, and the reason is related to this. |
@jkarlin I think a good solution would be to only allow |
@beverloo who would know more than me about push and how sync should interact with it. |
Any idea that how should I send upstream messages from service worker via register-sync approach? The same error raised up when I tried to do it. @mohamedhafez if the security issue is the culprit here, then why is the sync-event even placed in service-workers? |
This issue occurs for apps loaded inside an iframe too, regardless of whether the window is open or not. |
The Push API spec suggests to use Background Sync for
pushsubscriptionchange
. We would also like to use Background Sync for the reliable processing ofpush
events.However those events may be triggered when no window is opened and this causes an error in Chrome:
Can you allow the usage of
sync.register
even when no window is opened?The text was updated successfully, but these errors were encountered: