We may earn an affiliate commission when you visit our partners.
Course image
Hussein Nasser

However, what’s truly more challenging is designing real-time backend applications that support unfettered and ad-hoc bidirectional communication. The workloads of gaming, chatting, and even mission-critical real-time applications are unique in that they require a “push” nature to function effectively.

I spent a few months designing this course, and I chose the WebSockets protocol as the foundation for this work. WebSockets is by far the most widely available bidirectional protocol, supported across all clients—from browsers and command-line apps to runtimes like Node and Bun, and even other languages like C and Go.

Read more

However, what’s truly more challenging is designing real-time backend applications that support unfettered and ad-hoc bidirectional communication. The workloads of gaming, chatting, and even mission-critical real-time applications are unique in that they require a “push” nature to function effectively.

I spent a few months designing this course, and I chose the WebSockets protocol as the foundation for this work. WebSockets is by far the most widely available bidirectional protocol, supported across all clients—from browsers and command-line apps to runtimes like Node and Bun, and even other languages like C and Go.

While there is the newer WebTransport protocol, it isn’t yet as widely supported or battle-tested as WebSockets. Perhaps I’ll refresh this course in a few years when WebTransport matures.

This course is divided into three main sections:

1. WebSockets Internals – A deep dive into the inner workings of the protocol: the handshake, keepalive mechanisms, frame headers, and how it behaves over TLS. We’ll also discuss limitations—because I believe understanding limitations helps us build better applications. Each lecture will include a coding session and a quiz at the end of the section.

2. Scaling WebSockets – Taking your WebSocket knowledge to the maximum: how to scale this protocol over HTTP/1.1, HTTP/2, and HTTP/3. We’ll cover implementation with proxies in both stream mode (Layer 4) and application mode (Layer 7), along with their pros and cons. Each lecture will include a coding session and a quiz at the end of the section.

3. Building Real-Time System Designs – Putting everything into practice by designing two systems: an I/O-intensive chat system and a CPU-intensive game. I’ll propose multiple designs for each and choose one to implement.

Prerequisite: Fundamentals of Backend Engineering.

I hope you enjoy the course.

Enroll now

Here's a deal for you

Save money when you learn with a deal that may be relevant to this course.
All coupon codes, vouchers, and discounts are applied automatically unless otherwise noted.

What's inside

Learning objectives

  • System design for real-time backend scaling
  • The internals of websockets
  • How websockets work
  • Websockets on secure tls
  • Scaling websockets with layer 4 proxying
  • Scaling websockets with layer 7 proxying
  • Websockets on http/2 and http/3
  • Building a real-time group chatting app (io intensive)
  • Building a real-time game app (cpu intensive)

Syllabus

Introduction
Welcome

Backend Engineers who are interested in leveling up their skills for real-time applications.

Course Outline
Read more

You can find the slides, referenced papers and source code under the resources of this lecture

If you can answer at least 8 out of 10 questions of this quiz move to next section

If we know the limitations of a protocol we can use it effectively.

This is an IO intensive , so we don't need as many backends so backends can be built in a mesh architecture.

No load balancing, client picks the server, only rooms within the server can be used.  No database, very simple.

Pros, simple

Cons, can't chat with other servers, no load balancing (one server can get overloaded if the url is shared)

Load balanced at stream level, client connects to the closest gateway, fleet of backends per gateway. a pub/sub to relay messages.

Client sends a message streamed through gateway streamed through a backend, a backend writes it to the pub/sub and all backends subscribe to the pub/sub, message pushed to all backends subscribed. queue room number.

Pros: Can chat with other all rooms, load is balanced

Cons: Complex, more components, resource intensive (streaming)

WS application load balancing, h2 web sockets or even shared web sockets (less connections more streams) , gateways. Still pub/sub

Pros: Better resource usage (compare to Design 2) , load balancing

Cons: Complex more components, Backend implementation is tricky (h2)

Because we don't anticipate lots of backends. We can drop the pub/sub and have the backends talk to each other directly.

WS application load balancing, h2 web sockets or even shared web sockets (less connections more streams) , gateways. 

Pros: Better resource usage (compare to Design 2) , load balancing

Cons: Less complex than Design 3, ditched the pub/sub system

  • Gamers join an interactive World game

  • Gamers interact with objects to “break”

  • Breaking an item gets XP based on the item

  • Only one gamer gets the XP (last one that destroy it)

  • All game World must update in real-time

CPU intensive, game need to scale

When a player make a move or attack, a ws msg is sent, the new game state is calculted and the diff is sent to  all players get the new state. Or we can send the moves and have the clients calculate the state.

No load balancing, locality and lowest latency. Clients pick the server. You can only join games in the same server you connect to. Simple design. We can restrict the number of players per game and restrict players accordingly (each box can handle x concurrent games)

When a player make a move or attack, a ws msg is sent, the new game state is calculated and the diff is sent to  all players get the new state. Or we can send the moves and have the clients calculate the state. The moves are labeled and ordered by arrival time.

No need for a database

Pros: Low latency

Cons: A single Server can be overloaded if too many players join

Load balancer that is game aware when a game is created it will pick a server.

Players who want to join to the same game will "land" on that server.

Pros: Scalable

Cons: Need more components, we need to see All active games, we need to a database to store games.

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Career center

Learners who complete Realtime Backend System Design with WebSockets will develop knowledge and skills that may be useful to these careers:

Reading list

We've selected 50 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Realtime Backend System Design with WebSockets.
Provides a comprehensive overview of RESTful API design, covering the principles, best practices, and common pitfalls. It must-read for anyone who wants to design and build RESTful APIs.
Takes a holistic approach to API design, covering not only the technical aspects but also the business and user experience aspects. It great choice for anyone who wants to learn how to design APIs that are both effective and user-friendly.
Is widely considered a must-read for anyone working with distributed systems. It provides a comprehensive overview of the fundamental concepts and challenges in building data-intensive applications, which form the basis of many distributed systems. It's highly valuable as a reference tool and is often recommended as essential reading for both students and professionals.
Focused squarely on RFC 6455 mechanics and the browser WebSocket API, Lombardi walks developers through HTTP upgrade handshakes, binary frame handling, subprotocol negotiation, and connection heartbeats. Practical Node.js examples demonstrate real-time chat and live telemetry.
Covers the unique challenges of designing APIs for the cloud, such as scalability, reliability, and security. It valuable resource for anyone who wants to learn how to design and build cloud-based APIs.
Provides a deep dive into the challenges of building scalable web architectures, covering topics such as load balancing, caching, and data management.
Provides practical guidance on how to secure APIs, covering a wide range of topics such as authentication, authorization, and data protection. It valuable resource for anyone who wants to learn how to protect their APIs from security threats.
Enterprise real-time architecture comes into sharp focus as Wang, Salim, and Moskovits layer higher-level messaging protocols—STOMP, XMPP, and VNC/RFB—directly over persistent WebSocket streams. Security, proxy traversal, and load-balancing strategies receive thorough treatment.
A foundational textbook providing a broad understanding of distributed systems principles. It covers essential topics like communication, synchronization, consistency, and fault tolerance with clear explanations and real-world examples. is commonly used as a textbook in university programs and solid resource for gaining prerequisite knowledge.
Evaluating when to deploy WebSockets versus Server-Sent Events (SSE), HTTP/2 streams, or WebRTC data channels requires understanding wire-level framing and head-of-line blocking. Grigorik's benchmark-driven analysis of RFC 6455 framing and TLS overhead is essential reading.
Microservices are a prevalent architectural style in modern distributed systems. provides a practical guide to designing and implementing microservices, covering topics like service decomposition, communication, and deployment. It's highly relevant for professionals and students interested in contemporary distributed system architectures.
Scaling stateful WebSocket servers to millions of concurrent connections demands distributed pub/sub, presence tracking, and graceful reconnection strategies. Bussey demonstrates how Elixir and Phoenix Channels solve real-time fan-out, backpressure, and cluster split-brain pitfalls.
Provides a comprehensive guide to designing and building data-intensive applications, covering topics such as data modeling, storage, processing, and analysis.
This advanced guide to proxy servers provides detailed information on the latest proxy server technologies and techniques. It covers topics such as load balancing, failover, and caching, and it also includes chapters on how to use proxy servers to improve network security and performance.
Provides a collection of recipes for common API design problems, such as how to handle authentication, pagination, and error handling. It great resource for anyone who wants to find quick and easy solutions to common API design challenges.
A classic and in-depth exploration of the TCP/IP protocol suite. is essential for anyone seeking a deep understanding of how the fundamental internet protocols work at a detailed level. While not a recent publication, its foundational content remains highly relevant and it serves as an invaluable reference for network professionals and advanced students.
Provides a comprehensive overview of backend development using Node.js and Express, covering essential concepts, best practices, and common challenges faced by backend developers.
Focusing on the design of distributed real-time embedded systems, this book takes a system-level approach. It addresses real-time, distribution, and fault-tolerance issues with a balance of academic concepts and industrial examples. is excellent for advanced undergraduates and graduate students, and it's a strong reference for practitioners working on distributed real-time applications. The third edition includes updates on complexity management, energy awareness, and the Internet of Things.
Provides a comprehensive overview of scalability, covering the principles, patterns, and practices for designing and building systems that can handle increasing demands. It is an excellent resource for software engineers and architects who need to understand how to design and build scalable systems.
This comprehensive guide to proxy servers provides a detailed overview of the different types of proxies, their functions, and their advantages. It also includes chapters on how to set up and configure proxy servers and how to use them to improve network security and performance.
Authored by the specification lead for the Java API for WebSocket (JSR 356), this guide explains annotated endpoints, message encoders/decoders, asynchronous send modes, and container lifecycle management on enterprise JVM servers.
Authored by Google SREs, this book provides invaluable insights into operating large-scale distributed systems reliably. It covers practices like monitoring, incident response, and capacity planning, which are critical for the successful operation of distributed systems in the real world.
Provides a practical guide to designing and analyzing real-time systems, offering a holistic, systems-based approach. It covers hardware considerations, software requirements, design, and performance estimation. It is suitable for both students and practicing engineers and valuable reference for its practical tips and code examples. The later editions incorporate object-oriented technologies and agile methodologies.
This textbook covers a wide range of topics in distributed computing, including principles, algorithms, and systems. It's a valuable resource for gaining a solid academic understanding of the field and is suitable for advanced undergraduate or graduate-level study.
Classic in the field, focusing on the theoretical underpinnings of distributed algorithms. It's a rigorous exploration of fundamental problems like consensus, and while theoretical, it solidifies understanding of the core algorithmic challenges in distributed systems. It is more suitable for those seeking a deep, theoretical understanding.
Specifically addresses the challenges and techniques for scheduling tasks on multiprocessor real-time systems. Given the prevalence of multi-core processors, this highly relevant and contemporary topic. It is suitable for graduate students and researchers focusing on advanced scheduling problems.
Save
Contemporary distributed systems often involve large-scale data processing, and this book focuses on streaming systems. It covers the principles and practices of building systems for processing data in motion, a key aspect of many modern distributed applications.
This handbook offers comprehensive coverage of advanced and timely topics in real-time and embedded systems, bringing together contributions from researchers in academia and industry. It examines scheduling, resource management, programming languages, operating systems, and middleware. It's an excellent reference for researchers and professionals seeking in-depth information on various facets of the field.
Apache Kafka widely used distributed streaming platform. provides a comprehensive guide to Kafka, covering its architecture, design, and implementation. It's highly relevant for anyone working with or interested in stream processing in distributed systems.
Given the importance of data in distributed systems, understanding how databases work internally is crucial. explores the fundamental concepts behind distributed data systems, including storage engines and replication. It provides valuable background knowledge for anyone building or working with data-intensive distributed applications.
Modern real-time web backends bridge durable event logs like Kafka directly to browser clients over WebSocket gateways. Kumar illustrates how to decouple high-velocity event ingestion from stateful client-facing WebSocket push tiers.
Event-driven nonblocking I/O makes Node.js and the ws library a dominant stack for real-time WebSocket servers and horizontal Redis pub/sub scaling. Casciaro and Mammino detail streams, backpressure, and distributed messaging patterns critical for socket stability.
Microservices are a popular approach to building scalable systems, and this book provides a practical guide to designing and implementing microservices-based systems. It covers topics such as service discovery, load balancing, and fault tolerance.
Offers an approachable introduction to distributed systems concepts for developers. It aims to provide a solid understanding of the key challenges and considerations when working with large distributed applications. It's a good starting point for those new to the field before diving into more in-depth texts.
Offers a blend of theoretical concepts and practical examples with a focus on open-source real-time operating systems (RTOS). It helps designers understand the trade-offs between traditional and modern methods and is particularly useful for those interested in the embedded systems aspect of real-time systems. It provides hands-on knowledge of how RTOS are applied in embedded contexts.
Comprehensive and foundational text covering the theory and concepts of real-time computing and communication systems. It delves into scheduling, resource access control, and validation techniques. It's widely used as a textbook for senior undergraduate and graduate students and serves as a valuable reference for professionals. While not the most recent, it provides essential background knowledge.
Covers scheduling, analysis, and verification techniques for real-time systems. It provides a solid theoretical foundation and explores formal methods for ensuring the correctness and timeliness of real-time applications. It is suitable for graduate students and researchers with an interest in the theoretical aspects of real-time systems.
Provides a comprehensive guide to building enterprise-grade backend applications using the Spring Boot framework.
Provides a practical approach to understanding network protocols by analyzing network traffic using Wireshark. It is an excellent resource for gaining hands-on experience and seeing how protocols function in real-world scenarios. This book is highly relevant for anyone involved in network troubleshooting or security.
For organizations migrating from monolithic architectures to microservices, this book provides essential guidance and patterns for a successful transformation. It addresses common challenges and strategies for decomposing monoliths into distributed services.
Focuses on building distributed services using the Go programming language. It provides hands-on guidance and practical examples for developing reliable and scalable distributed systems, making it particularly useful for developers working with Go.
This e-book focuses specifically on load balancing in cloud environments, which is highly relevant given the course topics. It discusses the options and considerations for implementing load balancing in a dynamic cloud infrastructure, including the use of software load balancers like NGINX. It's a practical guide for those working with cloud platforms.
Specifically addresses load balancing within the Microsoft Azure cloud platform, often in conjunction with NGINX. It offers practical solutions and design considerations for implementing load balancing for applications hosted on Azure. It is highly relevant for those focusing on Azure-specific load balancing services.
Scaling concurrent WebSocket servers demands non-blocking I/O and lightweight task scheduling. Samson demystifies Rust's async runtime internals, epoll/kqueue event loops, and green-thread patterns that power ultra-low-latency real-time messaging.
A more comprehensive book on network security, covering both the principles of cryptography and their applications in network security protocols. is suitable for those who want to delve deeper into the security foundations of network communication. It is often used as a textbook in advanced security courses.
Maintaining thousands of open WebSocket coroutines in Python requires disciplined event-loop management, task cancellation handling, and clean socket shutdown. Hattingh provides the concurrency mental model required for reliable websockets and aiohttp services.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Realtime Backend System Design with WebSockets.
Authentic Node.js WebSocket Server Workshop
Most relevant
Microservice Architectures
Most relevant
Social Entrepreneurship
Most relevant
The Complete Cloud Computing Software Architecture...
Most relevant
Software Architecture & System Design Practical Case...
Most relevant
Software Architecture & Design of Modern Large Scale...
Most relevant
Mastering the System Design Interview
Most relevant
The Complete Guide to Becoming a Software Architect
Most relevant
Master Software Architecture & System Design for...
Most relevant

Udemy Buyer Protection & Guarantee

Verified partner policies & purchase protections

Global Marketplace Leader
Free Trial & Audit

Free Lecture Previews

Free preview video lectures available for all courses; optional 7-day free trial on Personal Plan subscriptions (cancel before trial ends to avoid conversion).

Return & Refund Policy

30-Day Money-Back Guarantee

30-day money-back guarantee on all eligible individual course purchases (provided course content has not been substantially consumed or downloaded). Subscription fees are non-refundable once billed.

Buyer Protections

Verified Academic & Industry Partner

Lifetime access to purchased individual courses and future updates, verifiable certificate of completion, and direct student Q&A forums.

Key Purchase Protections
30-day 100% money-back guarantee on course purchases
Lifetime access on web, mobile, and offline
Certificate of completion included with purchase
Direct instructor Q&A and active student community
OpenCourser Verified Partner Policy details last reviewed: 2026-10-22
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser