WebSockets
Real-time, pub/sub, presence, backpressure
- 00 WebSockets & realtime — Roadmap Ten chapters that go from 'what is the WebSocket handshake' to a self-hosted, horizontally scaled realtime server with Redis pub/sub, presence, auth, and nginx in front. beginner 5 min →
- 01 What WebSockets are and when to use them A WebSocket is a bidirectional, persistent TCP connection that starts life as an HTTP request. Useful when neither REST nor RPC fits. Misused often. beginner 10 min →
- 02 The handshake and frame protocol RFC 6455 in the parts that matter for shipping a server. Upgrade headers, frame layout, masking, opcodes, close codes, and the rules a library follows so you do not have to. beginner 12 min →
- 03 Your first server End-to-end Go WebSocket server in eighty lines, with a browser client. By the end you have an echo service plus a tiny chat room — both running on localhost, both real. beginner 11 min →
- 04 Message protocols on top Raw frames carry bytes. Real apps need types, versions, and request/response correlation. Designing the message envelope before you have ten clients in the wild saves you years of pain. beginner 12 min →
- 05 Server-Sent Events When the client only listens, SSE beats WebSockets in every dimension that matters — simpler protocol, free reconnect, plain HTTP. The default for one-way realtime. intermediate 11 min →
- 06 Pub/sub at scale One process can hold thousands of connections; production needs many. The piece that makes that work is a pub/sub bus that fans events from any process to every connection on every other process. intermediate 12 min →
- 07 Presence and rooms Knowing who is online and which channel they are watching looks easy in a one-process demo and is genuinely hard at scale. The data model is half the work; the eviction story is the other half. intermediate 12 min →
- 08 Auth, origin, and rate limits WebSocket handshakes look like normal HTTP, which makes them subject to normal HTTP attacks plus a few WebSocket-specific ones. Verify origin, authenticate at the handshake, and rate-limit at every level you can. intermediate 12 min →
- 09 Backpressure, reconnects, heartbeats Networks drop. Clients stall. Tabs sleep. The patterns in this chapter are the difference between a WebSocket service that runs for a week and one that limps for an hour. advanced 13 min →
- 10 Production self-host Behind nginx with TLS, systemd-managed, observable, scaled across processes via Redis. Same operational shape as the GraphQL and gRPC tracks — different protocol on the wire. advanced 14 min →