My tool websocat is specifically designed for this.
websocat ws://your_server/url
You can connect and exchange data with your server. By default each line becomes a WebSocket text message and vice versa.
On Linux it is more comfortable to play with it using readline:
rlwrap websocat ws://your_server/url.
It is not the only CLI websocket client. There are also “ws” and “wscat” projects.