binance-futures-connector-java icon indicating copy to clipboard operation
binance-futures-connector-java copied to clipboard

Feature proposal: client side websocket ping

Open gawronA opened this issue 1 year ago • 3 comments

Hello, this PR is my feature proposition.

Currently this library is not able to detect lost connection with Binance Websocket API.

I have exposed pingInterval attribute of OkHttpClient as optional parameter for UM/CMWebsocketClientImpl to be set by user accordingly to needs. This issues the client to send ping frames to Binance Websocket API and await pong response. When connection is lost (e.g. due to Wi-Fi/Internet disconnection), onFailureCallback will be triggered after at most pingInterval.

Please let me know if this change fits. I'm open to comments and suggestions.

gawronA avatar Mar 29 '23 21:03 gawronA