#121: ReadableStreams (specs: Streams, Fetch)

Visit on Github.

Opened May 13, 2016

Streams spec: https://streams.spec.whatwg.org/

PR merged to Fetch spec: https://github.com/whatwg/fetch/commit/4924f6d6a2b9cdbdadffc1885141542311bda986

Scope of interest In particular, the scope we are interested in at the moment is about ReadableStream:

  • ReadableStream from the Streams API represents a sequence of objects/bytes with queuing and back-pressure propagation. It’s intended to be widely used by various web platform APIs as a unified way to output data. The first adopter is the Fetch API.
  • The Request and Response object allows for streaming body data by exposing a ReadableStream.

Motivation The ability to create a Response backed by a ReadableStream is extremely powerful in the context of ServiceWorker as it allows SW-controlled pages to stream data to greatly improve the Loading user experience. Concretely, the renderer of the page can parse and render the chunks as soon as they arrive, and therefore rendering latency is reduced. This is important for Progressive Web Apps that want to compose cached content with content fetched over the network.

Discussions