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

What is a push subscription associated with? #384

Closed
annevk opened this issue Jul 17, 2024 · 2 comments · Fixed by #388
Closed

What is a push subscription associated with? #384

annevk opened this issue Jul 17, 2024 · 2 comments · Fixed by #388

Comments

@annevk
Copy link
Member

annevk commented Jul 17, 2024

I was trying to make sense of subscribe() but it did something unexpected. It looks at a service worker registration's active worker and uses that to obtain a push subscription. However, very early on in this document we have this description:

Each push subscription is associated with a service worker registration and a service worker registration has at most one push subscription.

What gives?

It does seem like rejection when there's no active worker is intentional: #230.

It also seems to me that a push subscription is not stored with a service worker as you should be able to replace the service worker and retain the subscription.

There's also some weirdness around "having" a push subscription apparently being known information but "getting" the push subscription requiring a "request" (whatever that is).

@mkruisselbrink
Copy link

Yeah, that doesn't seem right. As far as I can tell while having an active worker is indeed intentional, the registration itself is associated with the registration and not tied in any way to any specific version of the service worker within that registration.

@saschanaz
Copy link
Member

saschanaz commented Jul 17, 2024

It also seems to me that a push subscription is not stored with a service worker as you should be able to replace the service worker and retain the subscription.

Probably something related to whatwg/notifications#205 with the same purpose, tied with @mkruisselbrink said above: "SW un-registration should kill the push subscription and shouldn't persist whatever the previous registration had"

So I guess updating SW should be accompanied with a manual update for the subscription too? (I haven't checked whether that's something actually happening or not)

cc @asutherland

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

Successfully merging a pull request may close this issue.

3 participants