SystemCity
WorkspaceProblemsCanvasPricing
Sign in
S

SystemCity

AI-powered system design tutor. Learn architecture, ace interviews, build real systems.

Learn

  • Learn System Design
  • Interview Prep Guide
  • All Problems
  • Glossary
  • Compare
  • Design Canvas

Product

  • Pricing
  • Portfolio
  • Support

Legal

  • Terms
  • Privacy
  • Refunds

© 2026 SystemCity. All rights reserved.

Master system design · interview prep · 120+ problems

Back to glossary

Communication & APIs

WebSocket

A persistent, bidirectional communication channel between client and server over a single TCP connection — the standard for real-time web features.

In depth

WebSocket is a protocol that upgrades an HTTP connection into a persistent, full-duplex TCP channel. Once established, both client and server can send messages independently and at any time, without the overhead of new HTTP requests. This is fundamentally different from request/response protocols and is essential for real-time features: chat, live notifications, collaborative editing, multiplayer games, live dashboards, and trading interfaces.

WebSocket connections are stateful and long-lived, which complicates load balancing (sticky sessions or external state like Redis pub/sub are typically needed), scaling (each server holds open connections — file descriptor and memory limits matter), and deployment (a graceful restart must drain connections). Modern alternatives or complements include Server-Sent Events (SSE) for one-way server-to-client, WebRTC for peer-to-peer, and HTTP/3 streams.

Production WebSocket systems usually pair with a pub/sub broker (Redis, NATS, Kafka) so any application server can deliver a message to any connected client regardless of which server holds the socket.

When to use

Use WebSocket whenever the server must push messages to clients with low latency: chat, notifications, live updates, real-time collaboration, gaming.

Tradeoffs

WebSocket complicates infrastructure (sticky load balancing, connection draining, state). For purely server-to-client use cases, SSE is often simpler. For request/response, regular HTTP is much easier to operate.

Related terms

Pub/Sub

A messaging pattern where publishers emit messages to topics without knowing who consumes them, and subscribers receive messages from topics they care about.

Load Balancer

A component that distributes incoming network traffic across multiple backend servers to maximize throughput, minimize response time, and avoid overload.

REST API

An architectural style for web APIs based on HTTP verbs (GET, POST, PUT, DELETE) acting on resources identified by URLs.

gRPC

A high-performance RPC framework using HTTP/2, Protocol Buffers, and code generation for type-safe, low-latency service-to-service communication.

GraphQL

A query language for APIs that lets clients request exactly the fields they need in a single request, eliminating over- and under-fetching.

Message Queue

A buffer that holds messages between producers and consumers, enabling asynchronous processing and decoupling of services.

Practice this concept

EasyMessaging

Design an Online Presence Indicator Service

MediumMessaging

Design Facebook Messenger

EasySocial Media

Design a Nested Comments System

EasyIoT

Design an Efficient Parking Lot System