Registry / testing / wscat
library6.1.0jsnpmunverified

wscat is a command-line WebSocket client and server, enabling interactive communication with WebSocket endpoints. Current stable version is 6.1.0, released irregularly as part of the websockets ecosystem. It supports both connecting to servers and listening for connections, with features like authentication, SSL/TLS, proxy support, and slash commands for control frames. Unlike browser-based WebSocket tools, wscat is lightweight and runs directly in the terminal with Node.js. Appropriate for testing, debugging, and scripting WebSocket interactions.

npm install wscat
INSTALL
IMPORT
SIG · WSCAT
W
wscat
testingjavascriptv6.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wscat CLI
✓ npx wscat -c ws://example.com
✗ npm install wscat && node -e 'require("wscat")'
wscat is a CLI tool, not a library; use npx or global install.
programmatic usage
✓ import { wscat } from 'wscat'
✗ const wscat = require('wscat')
Package exports a function, but it's not documented for programmatic use.

Install wscat globally and demonstrate connect and listen modes with authentication.

# Global install npm install -g wscat # Connect to a WebSocket server wscat -c wss://echo.websocket.org # Listen on port 8080 wscat -l 8080 # Connect with authentication wscat -c wss://example.com --auth username:password
Debug
Known issues
breakingwscat v6 drops support for Node <18
fix
Upgrade Node to version 18 or later.
affects: >=6.0.0
gotchawscat is not a library; do not import programmatically
fix
Use as CLI only. For programmatic WebSocket use the 'ws' package directly.
affects: >=5.0.0
deprecatedUse of --protocol flag is deprecated
fix
Use --subprotocol instead.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Cannot find module 'wscat'
wscat is not installed globally or locally
fix
Run 'npm install -g wscat' to install globally.
Error: connect ECONNREFUSED
WebSocket server is not running or unreachable
fix
Ensure the server URL is correct and the server is running.
Upgrade
Version history
6.1.0latest on npm
Audit
Dependencies
commanderrequiredcommand-line argument parsing
wsrequiredWebSocket implementation
Agent activity
33 hits · last 30 days
node
32
Resources
packagewscat ↗
wscat — npm install wscat · libregistry