Documentation
¶
Overview ¶
Command wsecho is a WebSocket echo server and a client for it. The kind end-to-end test uses both to check that a WebSocket handshake through Traefik and Envoy Gateway is inspected: an allowed one upgrades and echoes, a denied one gets no upgrade (#276).
The server answers a WebSocket handshake on any path, from any origin, and echoes every message; /sse and /sse-leak answer Server-Sent Events (#323): two clean events, or a clean one, one leaking a MySQL error and a last one, each flushed on its own; /leak answers an HTML page leaking the same error; any other request gets 200 "ok".
wsecho -listen :8080
The client sends one handshake, with the headers given, and prints "upgraded" when the server answered 101 Switching Protocols and echoed a message (-message, or a greeting), the status code it answered instead (403, ...), or "closed CODE" when it closed the WebSocket with that code instead of echoing (1008, ...).
go run ./hack/wsecho -host ws.example.com -origin https://app.example.com 127.0.0.1:18091/chat