Suddenly stoped recieving klines data from Binance websocket

Hi! I’m using ReconnectingWebsocket to get kline_1m data from Binance. Everything goes well. However, at some random moment (1-2-3 days), despite the subscription to tickers, the data from the binance stops coming. Every 30 minutes I send {
method: ‘keepAlive’
However, I get a response {“error”: {“code”: 2, “msg”: "Invalid request: unknown variant keepAlive, expected one of SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_PROPERTY"}.
When the service is restarted, data begins to flow again. Also, if you add a subscription to a new ticker, the data comes from it.
Perhaps there is a limit on the number of subscriptions for one connection?
I would also like to understand how to send you a keepAlive message.

WSS would disconnect every 24 hours; You need to set a reconnection mechanism in your subscription code

Well, I sent Binance a subscription message like {
“method”: “SUBSCRIBE”,
“params”: [

“id”: 1
The problem was that if the length of the “params” array was greater than 333 I got from binance {
“result”: null,
“id”: 1
and not candles by subscription.

Give a try here -
If it works here, there must be something wrong with your wss processing code

1 Like