HTTP Streaming for Server Side Rendering
What is HTTP streaming?
Streaming is a technique through which the server sends chunks of data -read streams- sequentially, -individual snippets of HTML- to the frontend, to render over time.
Because we can decide what chunks we want to stream earlier, typically those that will be rendered over the fold, we can assume that we will get better Lighthouse and Web Core Vitalsscores.
Is HLS the same as HTTP Streaming?
Although the HTTP Live Streaming (HLS) protocol is the most widely used protocol to stream media, a form of data that can be buffered by the browser, this technique is now used more broadly for other MIME types, and is very effective when implemented in combination with edge computing or edge functions for composition, at the edge of the network, to return either snippets of HTML to rewrite, or a full page back to the CDN for caching and to the client-side to render the whole view.
With Node.js as a runtime, we can leverage its Stream API, to implement this technique.