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; 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