wscat
$ wscat Community Low Riskwscat (websockets/wscat) connects to ws:// and wss:// WebSocket servers from the terminal with custom headers (-H), subprotocols (-s), and TLS options. While bare wscat -c <url> opens an interactive REPL, -x <payload> and -w <seconds> enable non-interactive one-shot testing.
npm install -g wscat wscat opens raw WebSocket handshakes and exchanges custom frames against local or remote ws:///wss:// endpoints.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Defaults to a persistent interactive TTY REPL that hangs non-TTY agents unless -x <cmd> and -w <sec> are passed, and lacks --json framing.
- Requires
-x+-wfor non-interactive one-shot exit - Default
wscat -c <url>stays open waiting for stdin
Stateless client with strict TLS checks by default (unless -n / --no-check is passed).
- Verifies TLS certificates by default; no persistent credential storage
Lightweight npm package (wscat / npx wscat) across macOS, Linux, and Windows.
- Easy install via
npm install -g wscatornpx wscat
Quick diagnostic probe for WebSocket handshakes and echo tests, though limited for complex streaming assertions.
- Supports custom headers (
-H), subprotocols (-s), and TLS client certs
Maintained by the websockets org (ws library maintainers) under MIT license.
- MIT-licensed
websockets/wscatrepository
Brief README and --help output covering core flags.
- Concise
--helpand README flag list
Security, Auth & Guardrails
Stateless; accepts bearer tokens or API keys via -H "Authorization: ..." or --auth.
MIT open-source Node.js CLI; completely free.
# wscat Agent Rules - NEVER run `wscat -c <url>` without `-x <msg>` and `-w <seconds>` (or a timeout), otherwise it hangs in interactive REPL mode. - Do not pass `--no-check` (`-n`) in production TLS environments. - Keep secrets out of shell history by referencing env vars in `-H`.
Agent-Ready Command Recipes
Safe Read-Only Queries
wscat -c wss://echo.websocket.org -x '{"op":"ping"}' -w 2 Connects, sends one message with -x, waits 2 seconds (-w 2) for the reply, and exits cleanly.
wscat -c wss://ws.example.com/stream -H "Authorization: Bearer $WS_TOKEN" -x '{"type":"status"}' -w 3 Tests authenticated WebSocket handshake and initial response without hanging in REPL mode.
Strengths for Agents
- + Fastest one-liner (
npx wscat) for testing WebSocket handshakes, headers, and subprotocols. - +
-x+-wenables bounded non-interactive smoke checks.
Caveats & Pitfalls
- ! Hangs indefinitely in interactive REPL mode if invoked without
-xand-w(or an external timeout). - ! No structured
--jsonenvelope for connection status or frame metadata.