Open marxo opened 7 years ago
@hwillson: Oh, how we transfer bounties?
I added a $50 bounty. Would be very grateful if someone could match for the other $50.
@benjamn Are there plans to integrate HTTP2 now that it's a part of core node since 8.8.0 without a flag?
We're definitely open to exploring opportunities for using HTTP/2, though I suspect response multiplexing will be more impactful than server push, given that server push needs to know what resources the browser has in cache, so it doesn't send the client stuff it doesn't need (an easy way to achieve much worse performance with HTTP/2). For example, server push won't help with dynamic import()
, because the client has substantially better information about the modules it needs than the server could ever have, and we already use a WebSocket instead of HTTP for fetching dynamic modules.
Correct me if I'm wrong, but don't HTTP/2 clients automatically cancel server push downloads in-flight if they already have the necessary resources cached? How significant is the performance impact if the server just always tries pushing all required assets (with appropriate prioritization), relying entirely on the client to cancel the downloads for assets it already has cached?
As an alternative to server push, its also worth keeping an eye on the upcoming specifications for the Web Preload Standard and HTTP 103 early hints response code.
Theoretically yeah, though browsers aren't behaving properly yet - https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/#the-browser-can-abort-pushed-items-if-it-already-has-them
@benjamn it hasn't been included in 1.7 AFAIK so what's the next milestone is he still a short-term goal ?
Bumping this, been an issue since 3 May 2015. Any updates? Has it been assigned to a milestone?
An alternative to http2-server push we can use web preload specs by pre-loading the bundled *.js, *.css. Below is a workaround that injects the css, js preload links.
index.html (meteor index.html)
<!DOCTYPE html>
<html>
<head>
....
<body>
...
<script>
// enables automatic preloading meteor css/js file builds,
// without having to mess with meteor build system
// see https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
const meteor_css = document.getElementsByClassName('__meteor-css__')[0]
if(meteor_css){
const preloadCss = document.createElement("link");
preloadCss.href = meteor_css.href;
preloadCss.rel = "preload";
preloadCss.as = "style";
document.head.appendChild(preloadCss);
}
const meteor_js = document.querySelectorAll('script[src$="meteor_js_resource=true"]')[0]
if(meteor_js){
const preloadJs = document.createElement("link");
preloadJs.href = meteor_js.src;
preloadJs.rel = "preload";
preloadJs.as = "script";
document.head.appendChild(preloadJs);
}
</script>
</body>
I think http2 server-push would better be handled at the proxy server cause of http2 specs requirements ie requires SSL.
Migrated from: meteor/meteor#4319