๐Ÿ”Œ API Patterns and Practices: WebSockets
Home Chapters Examples Diagrams Bibliography GitHub โ†—
Home / Foundations
Part 1 4 chapters

Foundations

Why push beats polling, how to choose among WebSockets, SSE, long-polling, and webhooks, how the protocol itself works, and the shared domain every later chapter builds on.

Chapter 1

The Real-Time Problem

Why request/response falls short for a client watching something change, and what polling costs in requests, capacity and staleness.

9 min readRead โ†’
Chapter 2

Choosing the Right Tool

WebSockets, Server-Sent Events, long-polling, webhooks and gRPC streaming compared on seven dimensions, with an ordered decision rule.

15 min readRead โ†’
Chapter 3

How WebSockets Work

The HTTP upgrade handshake, frame layout, masking, close codes, subprotocols and extensions under RFC 6455.

15 min readRead โ†’
Chapter 4

The Shared Domain

The shipping domain for a live handling-event feed: which nouns travel on the wire, the event vocabulary and the seam with the REST booking service.

15 min readRead โ†’
โ† Previous part Prerequisites Next part โ†’ Contract-first for Sockets

API Patterns and Practices: WebSockets

Designing WebSocket APIs well, with runnable examples in Quarkus WebSockets Next and Python FastAPI/websockets against one AsyncAPI 3 contract, fanned out through a live handling-event feed.

Site

  • Chapters
  • Examples
  • Bibliography

Reference

  • RFC 6455 โ†—
  • AsyncAPI โ†—
  • MDN WebSocket API โ†—
  • View on GitHub โ†—
  • Issues โ†—
Open source ยท MIT Last built 2026-11-09