How karyych/websocket-dump works
WebSocket Dump is a small browser-based WebSocket testing console. A user connects the browser to /chat to exchange text or binary frames, while console controls invoke HTTP actions to broadcast messages, ping, or close active sessions. The Go server accepts and tracks connections, echoes client frames, and sends periodic pings. The README documents the UI and protocol capabilities; the sampled source shows the server routes and JavaScript wiring, but not the HTML implementation details.
Main entry points: main.js Console controls · server.go HTTP server · index.html Console page
Components 13
Browser console
- Console page
static/index.html - Console controls
static/main.js
Go server
- HTTP server
server.go - Chat handler
server.go - Text broadcast
server.go - Long-frame broadcast
server.go - Binary broadcast
server.go - Ping action
server.go - Close action
server.go
WebSocket sessions
- Client registry
server.go - WebSocket session
server.go - Serialized writer
server.go
Other components
- Tester
Connections 28
- Tester → Console page: uses
README.md - Console page → Console controls: loads controls
- Console controls → Chat handler: opens WebSocket
README.md - Console controls → Text broadcast: requests broadcast
static/main.js - Console controls → Long-frame broadcast: requests broadcast
static/main.js - Console controls → Binary broadcast: requests broadcast
static/main.js - Console controls → Ping action: requests ping
static/main.js - Console controls → Close action: requests close
static/main.js - HTTP server → Chat handler: routes `/chat`
server.go - HTTP server → Text broadcast: routes HTTP
server.go - HTTP server → Long-frame broadcast: routes HTTP
server.go - HTTP server → Binary broadcast: routes HTTP
server.go - HTTP server → Ping action: routes HTTP
server.go - HTTP server → Close action: routes HTTP
server.go - Chat handler → Client registry: registers session
server.go - Chat handler → WebSocket session: accepts and reads
server.go - Chat handler → Serialized writer: echoes frames
server.go - Chat handler → WebSocket session: sends periodic ping
server.go - Text broadcast → Client registry: iterates clients
server.go - Long-frame broadcast → Client registry: iterates clients
server.go - Binary broadcast → Client registry: iterates clients
server.go - Ping action → Client registry: iterates clients
server.go - Close action → Client registry: iterates clients
server.go - Text broadcast → Serialized writer: sends text
server.go - Long-frame broadcast → Serialized writer: sends long text
server.go - Binary broadcast → Serialized writer: sends binary
server.go - Ping action → WebSocket session: pings clients
server.go - Close action → WebSocket session: closes clients
server.go