- From: Stuart P. Bentley <notifications@github.com>
- Date: Fri, 24 Feb 2017 09:27:32 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/447/282351260@github.com>
Note that my username is @stuartpb; @stuartp is Stuart Park, who was last seen on GitHub in 2011 and has yet to comment on this thread. As for claiming pushes off a fetch... looking at a summary of the spec again (though I clearly haven't had a great batting average basing my suggestions on this so far), it looks like pushes only come in after headers have been received, which is when `fetch()` resolves, correct? So, wouldn't it make sense for a push handler to get attached to the `response` of a resolved `fetch`, like, say, via `response.addEventListener("push")`, where every event coming into that has properties that look something like the components of a fetch (ie. a response object to call `.clone()` or `.arrayBuffer()` on, and a `Request`-like object describing the resource being pushed)? Then, if you want to, say, pass along the `response` from a fetch, but *handle pushes*, *without* passing *them* along, you'd do something like `event.respondWith(response => response.addEventListener("push", pushHandler), response)` To only *selectively* claim *some* pushes, you could have the `push` event handler have some kind of behavior where either the `push` event has a `respondWith`-like method that lets you put the push "back in the pipe" to the next push handler (ie, any push handler attached to the response in the code receiving the response you passed to `respondWith`), or (better, IMO) you could just have the handler not claim and/or return the `push` coming in, and it'd get passed back into the pipe naturally. As for *instantiating* push responses to the fetch coming into the ServiceWorker... would it break anything to change the return type of `event.respondWith` from void to some kind of object that allows the ServiceWorker to instantiate pushes attached to the response (in addition to the pushes that would be coming in as part of the `fetch` response)? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/447#issuecomment-282351260
Received on Friday, 24 February 2017 22:35:25 UTC