Skip to content
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

Interacting with HTTP/2 push #215

Closed
jakearchibald opened this issue Apr 2, 2014 · 5 comments
Closed

Interacting with HTTP/2 push #215

jakearchibald opened this issue Apr 2, 2014 · 5 comments

Comments

@jakearchibald
Copy link
Contributor

HTTP/2 allows additional resources to be pushed with a response. This is something we may want to expose to SW.

This will probably need a new event, something like…

self.onpushresponse = function(event) {
  event.response;
  event.request;
};

This would be fired when the request portion is received and we're at the start of the body (same as when fetch resolves).

This allows the developer to add the request/response pair into a cache. It response should be abortable too, we should probably have .abort on response objects.

The network can also abort the request, i.e. if it matches something already in the HTTP cache. Because of this, we probably need a way for the SW to "claim" the pushed response. Maybe this is as simple as preventDefault.

(I don't think we need this for the first version of the spec, but we should ensure we don't do anything that gets in the way)

/cc @willchan

@tobie tobie added this to the v2 milestone Aug 7, 2014
@KenjiBaheux KenjiBaheux removed this from the Version 2 milestone Aug 8, 2014
@annevk
Copy link
Member

annevk commented Aug 12, 2014

Why should we expose HTTP/2 semantics like this? Would this pairing not happen automatically at the network layer?

@jakearchibald
Copy link
Contributor Author

If an HTTP/2 response comes with additional request/response pairings via push, it feels like the serviceworker should have some access to this so they can be placed in caches.

This isn't a v1 thing though.

@willchan
Copy link
Collaborator

I agree with the sentiment for simply keeping this in mind, but not explicitly working on this in v1.

I think we need use cases for this before designing too much for it. It's not obvious to me that it's clearly advantageous to allow network level pushes (via HTTP/2) to notify a ServiceWorker so it can populate an application cache, rather than sitting in the HTTP cache until claimed by the web layer (whether that be the document or the SW). But if someone has a good explanation for it, I'd be interested.

@annevk
Copy link
Member

annevk commented Mar 17, 2015

Closing this. Once there's a concrete plan we can open an issue. Now this issue just makes it less clear what is left to be done on the specification.

@annevk annevk closed this as completed Mar 17, 2015
@rektide
Copy link

rektide commented Nov 3, 2016

Not sure entirely what relation this has to push support in fetch but, but that issue is whatwg/fetch#51 . Also there's #796 which is a very specific use case of rejecting pushes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants