-
Notifications
You must be signed in to change notification settings - Fork 9
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
Supporting Headers in Pending Beacon #50
Comments
More details: |
What's currently supported in PendingBeacon inherits from Digging into discussion around
Aside from the above, to allow customizing headers, the shape of API also needs a big update:
cc @philipwalton @clelland WDYT? |
I don't think we need to be concerned with Cookies. Adding support for cookies is a separate problem. From a privacy perspective, it seems like there's not much difference between data going in a header and data going in the URL/body. If the page could have done a fetch with those headers, I don't see why it shouldn't send a beacon with them. It's just a question of whether there is a strong use case with no alternative. To be clear, I don't consider "use fetch+keepalive+headers" to be an alternative, if was we wouldn't need PendingBeacon. @toddreifsteck @annevk @igrigoric who were very involved in previous discussions. |
I need more details on why Fetch's |
Chrome will only recognize the registration in request headers: https://github.com/WICG/attribution-reporting-api/blob/main/EVENT.md#triggering-attribution. Why this API is designed this way and does not allow for data being in the payload or a URL parameter would be a question for Chrome's Attribution Reporting API, which we are trying to contact to understand this limitation. Fetch's keepalive has some reliability issues. Research has shown that many pings are dropped due to its reliability and PendingBeacon is directly aimed at mitigating this. |
@annevk the motivation for PendingBeacon is
The explainer has full details but I don't see a way to solve the fundamental problem with fetch+keepalive. If you think we shouldn't be pursuing this API at all, let's open a separate issue. |
I guess I would prefer we attempt to extend Fetch's |
This is not about keepalive being broken or not. There is no reliable way to send e.g. CLS-score when the page is destroyed. The only way to make it somewhat reliable is to over-send (e.g. send latest value every time it changes). Please discuss augmenting window.fetch in #52. |
Unfortunately the use case for our using PendingBeacon goes beyond just adding headers. Chrome's Attribution Reporting API parses the response in the renderer whereas PendingBeacon move the request/response onto the browser processer. So the renderer will never be able to read the response (not to mention the tab could be long closed at that point). I think Ming-Ying also mentioned that there is some discussion on potentially having an option where the beacon could be sent out before the navigation away happens? And potentially also being able to have the option to have requests/responses on the renderer? However, even if these options don't come to fruition, we'd like to keep this request alive since both APIs are currently being developed and changes could happen. We'll also be looking at #52 as a very real option here if it becomes a possibility. |
Browser process vs renderer process are implementation details that the spec would not talk about however, beacon has been designed so that it can be outside the renderer process for browsers that have that concept. We cannot make network requests from the renderer reliable, especially on mobile where RAM is scarce and keeping a backgrounded renderer alive just for the sake of a keep-alive network request is not going to be an option. I think a key point here is that your ask is for headers in the request (which seems reasonable to me) but also you want support for headers in the response and that is arguably not in keeping with the idea of beacons at all. Beacons don't have a response and while we have made that clear in the API (there is just is no way to get the response), I think we should also make it clear in the spec. We should probably say that, on success, the whole response should be ignored, body and headers. No cookies should be updated, no cache entries should be updated, no headers with side-effects, like attribution reporting, should be processed. I don't think we want a list of things that will/won't work with a beacon. "nothing at all" seems like the sanest option. |
Beware of scope creep. Based on my experience with WebSocket, people will demand every feature the HTTP protocol can possibly support. Each feature added will have a significant long-term maintenance cost. |
Address discussion in WICG#50 (comment)
This summarize the discussion from WebKit/standards-positions#85 (comment) and also potentially unblocks the need to add custom headers in WICG#50
* [Explainer] Add alternative approach to extend `sendBeacon` This summarize the discussion from WebKit/standards-positions#85 (comment) and also potentially unblocks the need to add custom headers in #50
Address comments from WICG#68 Also a follow up to WICG#50 and WebKit/standards-positions#85 (comment)
Address comments from #68 Also a follow up to #50 and WebKit/standards-positions#85 (comment)
The API is now repurposed as See the spec PR whatwg/fetch#1647 and explainer https://github.com/WICG/pending-beacon/blob/main/docs/fetch-later-api.md |
We would like to request header support in PendingBeacon.
The text was updated successfully, but these errors were encountered: