hitbtc-com / hitbtc-api

HitBTC API
GNU Lesser General Public License v3.0
324 stars 153 forks source link

Hitbtc socket closes randomly. #207

Closed mr-woot closed 6 years ago

mr-woot commented 6 years ago

While connecting to hitbtc socket, I sometimes face issue of getting socket in closed state. It automatically closes for some reason.

Some of the errors I tracked:


1.  {jsonrpc: "2.0", error: {code: 429, message: "Too many requests", description: ""},…}
error
:
{code: 429, message: "Too many requests", description: ""}
"subscribeCandles-NEOUSD",
jsonrpc: "2.0"```

2. Socket already in CLOSED state. When subscribing again to data stream after sometime.

Any others faced this issue?
mellertson commented 6 years ago

I ran it yesterday for 8 hours. I had one instance of a HitBTC object connect to 120 data feeds using WSS. It seemed to run correctly for an hour or so (hard to tell), but then I started the see the number 2 message you posted.

  1. Socket already in CLOSED state. When subscribing again to data stream after sometime.

Have you had any luck reconnecting it? Just curious what function calls or commands you might have used to have it reconnect.

hitbtc-com commented 6 years ago

You application should subscribe once, and fetch data from socket fast. If you try subscribe unsubscribe and again, then your requests will be rate limited. If you can't fetch fast data from the socket, then your connection will be closed. If you too often was slow, then your IP will be banned for an hour.