binance / binance-futures-connector-java

MIT License
111 stars 61 forks source link

Feature proposal: client side websocket ping #13

Open gawronA opened 1 year ago

gawronA commented 1 year ago

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.

2pd commented 1 year ago

Thanks for the PR, we will have a review

0xenAlpha commented 8 months ago

any update on this we're having the same issue.

panpeter commented 1 month ago

Any chance someone from the Binance team could review and merge it soon? 🙏