Hello, somewhere I have read that there is automatic mechanism to handle websocket pings. I cannot find that article now, can you help please? Thank you very much!
dino
January 16, 2023, 2:47am
2
It depends on which websocket client you are using. Please check the library document, it may response to server’s ping automatically.
TS_ST
February 1, 2023, 11:18am
3
Which language are you using? Here’s one example in the node.js connector
The node.js connector (“binance” on npm, since there’s a few) handles this by sending ping frames as heartbeats every few seconds (ping interval):
This starts a race condition (pong timeout):
The healthy winner in this race is either a message OR a pong frame reply before the pong timeout:
If neither happens before the pong timer expires, the connection is assumed to be dead and killed/respawned to replace it with a fresh one:
This is the most resilient way I’ve seen to manage this regar…