-
Notifications
You must be signed in to change notification settings - Fork 315
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
No good way to beacon during activate #1336
Comments
It looks like sendBeacon in workers was removed from the Beacon spec in favor of fetch keepalive: AFAICT fetch keepalive in workers works in the spec but implementations might not have it implemented yet. E.g., it looks like Chrome cancels the request if the worker is terminated: |
Thanks @mattto! Closing this issue as it looks like |
Let me reopen this because there is some talk of taking this away from service workers: |
F2F summary was that there are use cases for fetch keepalive in service workers there's no need for the spec to change the semantics to say it doesn't work in service workers. |
There currently doesn't seem to be a good way to fire a tracking beacon from the activate step. One use case would be tracking how quickly new versions of the service worker are actually activated (vs installed). Current options I can think of for beaconing during activate:
waitUntil(fetch('/beaconEndpoint'))
This is not good because now all fetch events are temporarily blocked untilfetch('/beaconEndpoint')
completes.fetch('/beaconEndpoint')
(withoutwaitUntil
) kicking off async operations outside ofwaitUntil
is not great. Might usually work but seems like it could have unwanted side effects or not be completely reliable, depending on the implementation.What if we supported
sendBeacon
for service worker? I believe this would solve the problem.Another option is to allow some way to schedule a task that doesn't block the event from completing. This would open up a big can of worms though, probably not ideal.
The text was updated successfully, but these errors were encountered: