I would like to use wscat on macOS, but this requires to install Node.js. So I decide to make the same command without Node.js. And I am learning Golang. This is a chance to learn more Golang through making this command.
go build wscat.go
./wscat -c ws://echo.websocket.org
You can use -i option when a sending data to a WebSocket server reads from a file. Also you can use -o option when a receiving data from a WebSocket server saves to a file you want. When you don't specify any options, sending data reads stdio and receiving data writes stdout.
./wscat -c ws://echo.websocket.org -i send.txt -o recv.txt