wscat is a command-line WebSocket client and server tool that provides an interactive terminal interface for connecting to WebSocket endpoints, sending and receiving text messages in real time, and managing WebSocket control frames through typed slash commands. It supports basic HTTP authentication by injecting credentials into the initial WebSocket handshake request, and can route connections through an HTTP proxy using the CONNECT tunneling method.
The tool includes a built-in WebSocket server mode that listens on a specified port, accepts incoming client connections, and relays messages between connected clients. It also supports automated command execution, allowing predefined commands to run automatically after a WebSocket connection is established. The event-driven message loop handles incoming WebSocket frames and user commands asynchronously, while slash commands map directly to WebSocket control frames for ping, pong, and close operations.
The project provides a collection of WebSocket client implementations, including a basic auth client, a CLI client, a control frame sender, and a proxy client, all accessible through a single command-line interface. The documentation covers installation and usage for both client and server modes.