Chapter 10. Streaming data
In part 5 of this book, we’ll focus our attention on the future of Progressive Web Apps (PWAs) and the many great features that are coming soon to a browser near you. In this chapter, we’ll look at a useful feature called the Web Streams API, which lets you stream content to your users.
We’ll dive into what web streams are and how to use them and go through some practical examples that you can apply to your PWAs today. You’ll start off by building a basic example using the Fetch API and then graduate to using the Web Streams API within a Service Worker to supercharge the load times of your web pages. If you think your web pages are fast after the earlier chapters, just wait and see how fast they can become.
For web developers, there’s never been a more exciting time to build for the web. Browsers are more feature-rich and devices more powerful each year. On top of that, we have great frameworks and tooling as well as features such as Service Workers that allow you to build amazing websites for your users. Using the Progressive Times application we’ve used in the book as an example, you could build a streaming video player or even use the streaming abilities of a browser to progressively render a large web page.
The Web Streams API lets you stream content to your users. For example, say you want to display an image on a web page. Without streaming, the following steps need to take place in the browser: