Writing a bash script to connect to GDAX's Websocket Feed at wss://ws-feed.gdax.com but curl doesn't seem to support this as I get
curl "wss://ws-feed.gdax.com" curl: (1) Protocol "wss" not supported or disabled in libcurl
WebSocket uses a unified TCP connection and needs one party to terminate the connection. Until it happens, the connection remains active. HTTP needs to build a distinct connection for separate requests. Once the request is completed, the connection breaks automatically.
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.
The Message event takes place usually when the server sends some data. Messages sent by the server to the client can include plain text messages, binary data, or images. Whenever data is sent, the onmessage function is fired.
Assuming you have node
installed, I would give wscat
a shot; it is simple, intuitive, and powerful. Otherwise, @Pavel's answer has an abundance of venerable websocket client alternatives.
# install npm install -g wscat # use wscat -c "wss://ws-feed.gdax.com"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With