A minimal WebSocket echo server written in Go, packaged with Docker.
Includes a simple HTML test page served at / so you can connect and test directly in your browser.
- WebSocket endpoint at
/ws - Echoes messages back to the client
- JSON-structured logs with timestamps, log level, and client IP
- Built-in HTML test page at
/
go run main.goOpen http://localhost:8080 in your browser.
# build image
docker build -t go .
# run container
docker run -p 8080:8080 go-wsGo to: http://localhost:8080 Use the test page to connect, send, and receive messages.
Using websocat:
websocat ws://localhost:8080/wsType any message — it will be echoed back.
Logs are JSON-formatted:
{"level":"info","time":"2025-09-18T08:55:10Z","message":"Client connected","client":"172.17.0.1"}
{"level":"info","time":"2025-09-18T08:55:15Z","message":"Received: hello","client":"172.17.0.1"}