This Bash script establishes a WebSocket connection to a server, allowing users to send a sequence of messages interactively. It is particularly useful for testing WebSocket APIs or automating WebSocket-based data subscriptions.
The script leverages websocat for WebSocket communication. If websocat is not installed, the script will prompt the user to install it automatically.
- Interactive Setup: The script prompts the user for essential parameters, including:
- WebSocket URL: Defaults to wss://example.com if left blank.
- Username and Password: For authentication in the WebSocket server.
- Currency (CCY): Used to specify the currency in the subscription message.