- From: Ilya Grigorik <igrigorik@google.com>
- Date: Mon, 19 May 2014 11:13:58 -0700
- To: Kornel Lesiński <kornel@geekhood.net>
- Cc: public-web-perf <public-web-perf@w3.org>, Jake Archibald <jakearchibald@google.com>, Alex Russell <slightlyoff@google.com>
- Message-ID: <CADXXVKr9ZjmY7=N3UT5Vw_vvK3oTOTn+7ebhh6qddaOi09YLOA@mail.gmail.com>
+jake, alex On Fri, May 16, 2014 at 5:14 PM, Kornel Lesiński <kornel@geekhood.net>wrote: > > It's not immediately obvious how the beacons should be "seen" by Service > Workers and how UAs should interact with them, so it'd be nice if the spec > gave some guidance about this. > > My suggestion is: > > The Service Worker should be able to intercept beacon requests. The > implementation of service worker should forward these requests immediately. > Even when Service Worker is used, the UA should still be in charge of error > handling and when it decides to retry sending the beacon it should make > another request. > I think that's implicit. All network requests should pass through SW, not sure we need a special carve out? > Basically, just passing the request through should be an ideal > implementation of the service worker. > > The alternative would be to make Service Worker responsible for queueing > and retrying beacon requests, which may seem like a good idea at first. > However, IMHO, that would be a sharp jump in difficulty for authors: > > - authors would have to reinvent UA's logic for managing network > traffic/priorities and strategy for optimal use of cellular radio power. > That's currently not even possible, and even if it was, that's a pretty > complex problem to throw at authors. > > - authors may use Service Workers for other reasons than interception of > beacons, so reliability of sendBeacon should not be negatively affected by > mere presence of a Service Worker. > > - having simple, useful default behavior without reliance on a service > worker is very useful, and doesn't stop authors from implementing > additional logic in the SW if they wish. > It seems like, at the very least, there should be some special flag on the beacon request, such that SW could identify beacon requests and carve out a special path for them? That would allow you to inherit default sendBeacon logic implemented by the browser. Alternatively, SW could synthesize a 200 response and then "roll its own" logic? ig
Received on Monday, 19 May 2014 18:16:15 UTC