Build real-time features in Node.js — a persistent, bidirectional channel between server and clients using the WebSocket protocol, the ws library and Socket.IO. You will finish able to build a live chat or notifications feature with events, rooms and broadcasting, then scale it across processes and combine it cleanly with a REST API.
Watch the free preview
Why real-time, and how WebSockets work — free to watch, no account needed.
What you'll learn
- Build real-time features in Node.js with WebSockets, events, rooms and broadcasting
- Explain the WebSocket protocol, its HTTP upgrade handshake and when to use it over polling
- Implement a live chat and notifications feature with the ws library and with Socket.IO
- Scale a real-time app across multiple processes with a Redis adapter and sticky sessions
- Combine a REST API with a real-time layer securely, with authentication and heartbeats
Syllabus
WebSockets and the Real-Time Problem
Why real-time, and how WebSockets workFree preview
Your first WebSocket server with ws
Broadcasting and Robust Connections with ws
Messages, events and broadcasting
Heartbeats, reconnection and the connection lifecycle
Socket.IO — Events, Rooms and Broadcasting
Socket.IO fundamentals — events and acknowledgements
Rooms, namespaces and broadcasting
Production Real-Time — Scaling and REST Integration
Scaling across processes with the Redis adapter
Combining REST with real-time, securely
Lab — 10 Exercises & Solutions
Exercises 1–5
Exercises 6–10