Implement automatic fallback from `sendBeacon` to `fetch` in glean.js
Categories
(Data Platform and Tools :: Glean: SDK, task, P1)
Tracking
(Not tracked)
People
(Reporter: Dexter, Assigned: janerik, Mentored)
References
Details
Attachments
(1 file)
We now have a sendBeacon
uploader for glean.js. However, on some browsers, sendBeacon
might not be available. We need to tweak the provider to fall back to fetch
if needed or create a new uploader to experiment with that.
After this is done, we can turn this on by default in glean.js while still offering users a way to switch back to the fetch
one.
Updated•1 year ago
|
Comment 1•1 year ago
|
||
For additional context:
This was implemented this way so that we could test things without breaking the original implementation. We want to always use sendBeacon
unless the client explicitly chooses to use fetch
. This should be something that is able to be set in the initialize
config object.
Our docs should also reflect that by default everyone should be using sendBeacon
unless they have a specific reason not to. The reason for sendBeacon
was to fix data loss issues caused by page unloads with fetch
in Firefox.
Feel free to reach out with any questions about the implementation itself, happy to help.
Updated•1 year ago
|
Comment 3•1 year ago
|
||
Updated•1 year ago
|
Assignee | ||
Comment 4•1 year ago
|
||
Description
•