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

Should Push responses be cached? #16

Closed
szmarczak opened this issue Jul 19, 2019 · 4 comments · Fixed by #19
Closed

Should Push responses be cached? #16

szmarczak opened this issue Jul 19, 2019 · 4 comments · Fixed by #19
Labels
agent enhancement New feature or request

Comments

@szmarczak
Copy link
Owner

Push streams are very useful while using a browser. We receive stylesheets, scripts, HTML content simultaneously.

Should Push responses be cached? Is there any real use case?

@szmarczak szmarczak added the discussion This issue needs feedback label Jul 19, 2019
@pietermees
Copy link

Maybe we could allow someone to provide an external cache implementation just like for the normal HTTP cache? That would allow consumers of the library to determine the right caching strategy?

Check out this post for an easy to understand description of the various caches: https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/

@szmarczak
Copy link
Owner Author

Maybe we could allow someone to provide an external cache implementation just like for the normal HTTP cache?

That would be cool. I just wonder how to do that. Should this be Agent-level?

Check out this post for an easy to understand description of the various caches:

Nice tips. But is there any real use case? I mean for browsers it's useful. Imagine you're scraping some websites. You don't need the images, do you? If you want to get them you can make another request. Only I can think of is preloading some data to display.

I think push streams should be off by default. But we could enable it's support through Agent (there would be a new function agent.onSession(session) and users would just override agent.request(...)}.

@pietermees
Copy link

Yeah, I agree, definitely not arguing for all those caches to exist. I guess my only point is that the PUSH cache is connection-specific while the HTTP cache is shared across all connections in a browser.

I agree that PUSH can be off by default (note that you can signal support for PUSH in the settings you send to the remote host, we should probably indicate that we don't support PUSH in those settings for efficiency reasons).

If the PUSH cache is per connection in the browser, I guess that maps to a session in Node?

@szmarczak
Copy link
Owner Author

If the PUSH cache is per connection in the browser, I guess that maps to a session in Node?

That's right.

@szmarczak szmarczak added the enhancement New feature or request label Jul 28, 2019
@szmarczak szmarczak added agent and removed discussion This issue needs feedback labels Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants