gw-05 — Execution

Prerequisites

  • Go ≥ 1.25 (stdlib only, offline). Optional: websocat for the live server.

One-shot

cd gw-05-websockets-pushy && bash scripts/verify.sh   # → "=== gw-05 OK ==="

Per-language workflow (Go)

cd gw-05-websockets-pushy/src/go
go test -race -count=1 ./...        # 11 tests in package pushy
go build -o /tmp/pushyd ./cmd/pushyd

Run the node

/tmp/pushyd -ws :8090 -admin :8091

# connect a device (first text message is its id):
echo device-42 | websocat ws://127.0.0.1:8090/ws -
# from another shell:
curl localhost:8091/stats
curl -X POST 'localhost:8091/deliver?device=device-42' -d 'hello'

No websocat? Use pushy.ClientHandshake + WriteMessage in a tiny Go client (both sides of the protocol are exported).

Package map

FileWhat
pushy/ws.goRFC 6455 handshake + framing (masking, ping/pong, close), Conn
pushy/registry.godevice→node registry with TTLs (crashed-node cleanup)
pushy/node.goconnection holding, slow-consumer isolation, message processor, publish
pushy/drain.gofull jitter, exponential backoff, reconnect-delay spreading, at-least-once dedup
cmd/pushydrunnable WebSocket node + push admin API

See GUIDE.md for the deep dive (incl. the net.Pipe deadlock lesson and drain).