# Communicating with server over Websocket using SocketConnect

I am trying to connect to a web socket feed of Gdax. The documentation is here, https://docs.gdax.com/#websocket-feed. There is no account needed and the information is public. I have successfully connected see this post, SocketConnect not connecting to web socket address

After connection, a subscription message needs to be sent. My json looks exactly like the documentation but not successful.

socket = SocketConnect["ws-feed.gdax.com:80"];

json = ExportString[<|"type" -> "subcribe",
"product_ids" -> {"ETH-USD", "ETH-EUR"},
"channels" -> {"level2",
"heartbeat", <|"name" -> "ticker",
"product_ids" -> {"ETH-BTC", "ETH-USD"}|>}|>, "JSON"];

WriteString[socket, json]



Yields an error message.

HTTP/1.1 400 Bad Request

Date: Wed, 07 Feb 2018 18:14:59 GMT

Content-Type: text/html

Content-Length: 177

Connection: close

Server: cloudflare-nginx

CF-RAY: -

<html>

<body bgcolor=\"white\">

<hr><center>cloudflare-nginx</center>

</body>

</html>


I also tried this as a HTTPRequest and returns same error message. I have also tried the request as a PUT to no avail.

request = HTTPRequest[<|"Body" -> json, Method -> "GET"|>];

WriteString[socket, request]


• Did you find anything new? I also have some issues with SocketConnect (see 166571). – anderstood Feb 26 '18 at 22:24