hitbtc-com / hitbtc-api

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

Question about rate-limit while subscribing on websocket #196

Closed WillHern91 closed 5 years ago

WillHern91 commented 6 years ago

I am trying to subscribe to about 60 pairs over the websocket feed however I am running into a few issues with Error 409 Rate limit. I am sending each subscription about .1 second apart. I was wondering if you guys could shed some light on the rate-limits when sending subscribe/unsubscribe messages through the websocket since I do not see any information on the API docs.

I have read the rate-limit information on the docs but those numbers do not seem to apply to the websocket and it seems like they are only applicable for the REST API.

icehongssii commented 5 years ago

I am wondering How did you send a request every 1minutes. If you don't mind can I see your code? as far as I know, I really can't find sending delayed requests to webserver. thank you.

mellertson commented 5 years ago

@WillHern91 are you instantiating a new HitBTC object for each new websocket feed? I've encountered the same issue as you, but I was instantiating a new HitBTC object for each new data feed. I resolved the issue by using only one HitBTC instance, and sending each new "subscribe" request through that one instance.

hitbtc-com commented 5 years ago

you should subscribe once and then handle update events see example https://gist.github.com/hitbtc-com/fc738c1b926d9d7aa7e3bd5247f792a1 If you subscribe/unsubscribe messages, then it means that you work with socket incorrect - you should use rest request