Examples

Every runnable example in this repo, mapped to the chapter it supports.

Every hands-on chapter in this site has a matching runnable example under examples/ in the repo. Each example ships both a Quarkus (WebSockets Next) and a Python (native websockets/FastAPI) implementation against the same AsyncAPI contract, driven by a verify.sh that proves the two stacks behave the same way.

Example What it shows Stacks Chapters
part3-handling-events Reference both-stack implementation of receiveHandlingEvent: one WebSocket connection per booking, server-to-client push only, replaying a deterministic fixture Both Chapter 8, Chapter 9, Chapter 10, Chapter 11
part4-connection The four connection concerns on top of part3: auth rejection, in-band error taxonomy, backpressure close, and heartbeat-detected dead peers Both Chapter 12, Chapter 13, Chapter 14, Chapter 17
part4-backplane Scale-out fan-out across four app instances over a shared backplane, run once on Kafka and once on Redis Both Chapter 15, Chapter 16, Chapter 18
part5-performance The same fixture replay in two wire encodings, JSON and Protobuf, negotiated via Sec-WebSocket-Protocol Both Chapter 19, Chapter 20
part6-observability The same channel with live OpenTelemetry tracing, structured logs, and metrics exported across the WS-to-LGTM seam Both Chapter 23
part6-testing The functional-HTTP and load testing layer at this site’s HTTP seams: Newman for functional checks, k6 for load, against part4-backplane’s compose stack Both Chapter 21

Running an example

Each directory is self-contained: a README.md (or PROTOCOL.md for the wire-level contract), a compose.yaml, and a verify.sh that proves it against the shared contracts/asyncapi.yaml.

cd examples/part3-handling-events && ./verify.sh

See Setup and the Lab for the full toolchain setup.