Not receiving ping frame from binance for Websocket Futures Market Stream

Hi. I have a few questions about Websocket Market Streams for Futures:

  1. I get disconnected pretty often some days more often then others can be every 5-8 minutes. I don’t seem to receive the ping frames so I don’t send pongs back. Can this be an issue for the disconnects?
  2. Is it ok to connect to many Futures Websocket Market Streams from a single machine? Can this be an issue for the disconnects?

For futures, Ping frame is not available yet, it’s fine to have multi streams subscribed from one client.

Have you tried with different client tool to subscribe the stream?

Thanks for the reply. I wrote the javascript client using native browser WebSocket API.
I am connecting to ‘wss://fstream.binance.com/ws/’. On top of it stream '‘wss://fstream.binance.com/ws/{symbol}@depth’ also disconnects many times sporadically. I am having disconnects way to often. What can I do to improve this aspect? If I lose User Data Stream I am missing the important order updates. There’s gotta be a solution to this. Please advise.

Our websocket connection is quite stable,
maybe this https://2pd.github.io/ws/ tool can be useful to verify the connection.

This is the implementation I have. I decided to use a single WebSocket connection for @depth and account updates. Some days are worse than others. I connected over the wire now rather than wife and still get disconnected sporadically. Here is the code. Please let me know where it can be improved.

let refreshInterval;
const listenKey = // getting a listenKey here using POST /fapi/v1/listenKey
const ws = new WebSocket(“wss://fstream.binance.com/ws/” + listenKey);

ws.onopen = () => {
refreshInterval = setInterval(() => {
// doing PUT /fapi/v1/listenKey to keep the listenkey alive
}, 1000 * 60 * 29);
ws.send(
JSON.stringify({
method: ‘SUBSCRIBE’,
params: [someTicker + ‘@depth’],
id: 1,
})
);
};

ws.onclose = async () => {
clearInterval(refreshInterval);
// handling reconnect here. it happens many very randomly sometimes multiple times an hour - sometimes not as often - the least is probably a few times a day.
};

FYI I tried to connect to https://2pd.github.io/ws/ and after a few hours got [“Websocket connection closed”] message.

I’ve run into the same issue and found a workaround. I shared the link below incase you are interested.

a few hours is much better than every 5-8 minutes, will forward to client for review.

So you recommend to connect to USER_DATA_STREAM and MARKET_STREAM separately? What kind of ping frames you recommend to send for USER_DATA_STREAM - something like this is ok ws.send(‘ping’) ?

The reason I connected them in a single ws connection was b/c both were closing frequently and I needed reconnect so it was easier to deal with a single connection. Thanks for the advice!