# Using sockets to connect to a trading platform

I'm trying to use Binance's API. The following works:

URLExecute[ <|"Scheme" -> "http", "Domain" -> "api.binance.com",
"Method" -> "GET", "Path" -> "/api/v1/time"|>]
(* {"serverTime" -> 1519522573487} *)


but I would like to use the socket instead. I tried

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time"]


but the last command never stops (even without the WriteString). I also tried replacing the first line with socket = SocketConnect["stream.binance.com:9443"], see binance doc, with the same result.

What is wrong and how can I connect to the socket to return, e.g., the server time or last orders?

Related: 26875 but does not use Mathematica's latest features and 165297.

socket = SocketConnect[{"api.binance.com", 443}]
WriteString[socket, "GET /api/v1/time \n"]

ByteArrayToString[%]

• At least I get an error now... I also get a 400 Bad Request error with WriteString[socket, "!ticker@arr\n"] (even without \n) but the string comes from the doc. And yes, I am looking for a timestamp or anything that shows that the connection with the socket is working, such as any live data from the website. – anderstood Feb 27 '18 at 18:17