GoogleChromeLabs/http2-push-manifest

push vs pull

ibrahimbensalah opened this issue · 1 comments

There are -in theory- two ways to efficiently load web resources from a website, one is the push method and the other one which nobody talks about is the pull method where the client is in charge of initiating requests to pull the necessary resources. Both methods will require some manifest to guide on pull or push just the required files, and both have different implications.

Push will require https, http2 support etc... but most importantly it doesn't know about which files are already there at the client's cache.

Pull will require a service worker on the client... it's only supported on chrome, but I guess it will land on all other major webbrowsers soon.

So my question is. if we aim at the future, what would be the preferred method and why?

This question has many subtleties :) As always, the answer is, "it depends on what you're doing".

By 'pull', I assume you mean sw precaching? The main difference between h2 push and sw precaching is that with h2 push, the resources get pushed to the client w/ the response of the page. IOW, the resources are already in the cache by the time you render the page. In sw precaching, any controlled page on the site can cache a set of resources. But the page needs to register the sw first, and then have it's caching code kick in. You also have fine grain control (you can check if the cache already has a resource, setup multiple caches, etc.).

My recommendation is to use h2 push for very small, critical resources. Use sw runtime/precaching for everything else, including providing an offline experience.

BTW, SW is also supported by Firefox and Opera and Safari has started to implement it.

Since the focus of this project is to provide an easy solution for http2 push, I'm going to close the issue.