on-internet
← Community

Implementing ping/pong for userData websocket

Stack Overflow ·

According to the Binance API: "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." So here's the problem I am having, I do have a websocket implementation however after that 10 minute period, it disconnect. My on('close') does not return me anything but I just stop getting any messages from the socket. This is the code I have to send back the pong: ws.on('ping', (data) => { console.log("ping: " + data); ws.

Comments

Sign in or sign up to comment and upvote.

No comments yet.