Until the emergence of WebSockets, the “realtime” web was difficult to achieve and slower than we’re used to nowadays; it was delivered by hacking existing HTTP-based technologies that were not designed and optimized for realtime applications.
WebSockets mark a turning point for web development. Designed to be event-driven & full-duplex, and optimized for minimum overhead and low latency, WebSockets have become a preferred choice for many organizations and developers seeking to build interactive, realtime digital experiences that provide delightful user experiences.
Who this book is for
This book is intended for developers (and any other types of technical audiences) who are
• Learning about the core building blocks of the WebSocket technology, its characteristics, and its advantages.
• Building realtime web apps with WebSockets.
What this book covers
Chapter 1: The Road to WebSockets looks at how web technologies evolved since the
inception of the World Wide Web, culminating with the emergence of WebSockets, a vastly
superior improvement on HTTP for building realtime web apps.
Chapter 2: The WebSocket Protocol covers key considerations related to the WebSocket
protocol. You’ll find out how to establish a WebSocket connection and exchange
messages, what kind of data can be sent over WebSockets, what types of extensions and
subprotocols you can use to augment WebSockets.
Chapter 3: The WebSocket API provides details about the constituent components of the
WebSocket API — its events, methods, and properties, alongside usage examples for
each of them.
Chapter 4: Building a Web App with WebSockets provides detailed, step-by-step
instructions on building a realtime web app with WebSockets and Node.js: an interactive
cursor position-sharing demo.
Resources — a collection of articles, videos, and WebSocket solutions you might want to
The reader should bear in mind that this is the first version of this book; therefore, it does
not intend to be exhaustive. In future versions, we plan to:
• Add more details to the existing chapters.
• Provide more examples and walkthroughs for building apps with WebSockets.
• Cover additional topics that are currently out of scope, such as engineering
challenges (for example, scaling and making WebSockets reliable), and alternatives