Stream being closed with "Stream truncated" websocket error when trying to subscribe for more than 30 streams by single websocket connection

Hi,

I have a problem with connection when I subscribe for more than 30 stream by single websocket connection.
My application is going to subscribe for 6 stream for each instrument. When I started to test how many subscriptions can be done by every websocket connection I found that it’s limited by 5(it’s equal to 30 stream). The sixth subscription makes socket closing with “Stream truncated” error.
API says each websocket connection is limited by 1024 streams which means it can support about 170 my subscriptions.
Can you explain what’s the reason of this behaviour?

Thanks,
Ethan

So, seems like it’s a spots stream only problem. For a futures it works fine for more than 30 subscriptions(180 streams)

Can you share how did you subscribe to the streams? I tried using
websocat wss://stream.binance.com:9443/stream?streams=<30streams> and it works fine.

I’m connecting to the stream.binance.com:443/ws and sending next requests

2022-08-08T06:04:46.948149Z [DoWrite] Sending request: {"id":78,"method":"SUBSCRIBE","params":["btcusdc@depth@100ms","btcusdc@aggTrade","btcusdc@ticker","btcusdc@bookTicker","btcusdc@kline_1d"]}
2022-08-08T06:04:46.948149Z [DoWrite] Sending request: {"id":79,"method":"SUBSCRIBE","params":["btcusdt@depth@100ms","btcusdt@aggTrade","btcust@ticker","btcusdt@bookTicker","btcusdt@kline_1d"]}
2022-08-08T06:04:46.948149Z [DoWrite] Sending request: {"id":80,"method":"SUBSCRIBE","params":["ethusdc@depth@100ms","ethusdc@aggTrade","ethusdc@ticker","ethusdc@bookTicker","ethusdc@kline_1d"]}
2022-08-08T06:04:46.948149Z [DoWrite] Sending request: {"id":81,"method":"SUBSCRIBE","params":["ethusdt@depth@100ms","ethusdt@aggTrade","ethusdt@ticker","ethusdt@bookTicker","ethusdt@kline_1d"]}
2022-08-08T06:04:46.948149Z [DoWrite] Sending request: {"id":82,"method":"SUBSCRIBE","params":["uniusdt@depth@100ms","uniusdt@aggTrade","uniusdt@ticker","uniusdt@bookTicker","uniusdt@kline_1d"]}
2022-08-08T06:04:46.948149Z [DoWrite] Sending request: {"id":83,"method":"SUBSCRIBE","params":["dogeusdt@depth@100ms","dogeusdt@aggTrade","dogeusdt@ticker","dogeusdt@bookTicker","dogeusdt@kline_1d"]}

And after this getting next:

2022-08-08T06:04:47.506026Z [ProcessFail] Connection error occured during read. Error code: stream truncated

I find out the problem. The problem is in the difference between futures and spots message per second limit. For the futures it’s 10 but for the spots it’s 5. Sorry for inconvenience.