Is the connection closing because it hasn’t received a pong, or is it unrelated?
I’ve been able to keep it open to 5minutes by requesting the “LIST_SUBSCRIPTIONS” endpoint every 60 seconds, as the above issue seems to be a browser specific issue where the sockets are closed if no activity is received within last minute or so.
So now the issue becomes, how do we keep the socket open more than 5minutes?
Just for reference on the ping/pong disconnection, the API doc says:
The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed.
As for keeping the socket open, maybe you can follow https://github.com/binance/binance-connector-node/blob/ef04ed3ddb139b9f0695af33e013a8516bef72ed/src/modules/websocket.js#L221 to write your code, or directly use the SDK (binance-connector-node).
Thanks @aisling for your response. Today it appears that with the browser fix, the socket is remaining open