-
Notifications
You must be signed in to change notification settings - Fork 610
Fix ping interval for websocket clients #292
base: master
Are you sure you want to change the base?
Fix ping interval for websocket clients #292
Conversation
|
Why not just change the interval here: binance-java-api/src/main/java/com/binance/api/client/impl/BinanceApiServiceGenerator.java Line 35 in 8d38e8e
? How did you come up with 3 minutes? |
|
@mkurz The 3 minutes is from the Binance documentation. The reason I am not changing it in the ServiceGenerator, is because the same client is used for the http connections, and they probably don't have the same pingInterval. |
The ping/pong from the documentation has nothing to do with the The
I highly doubt that |
|
It says in the documentation that it's used for both HTTP/2 and websocket connections. It probably does not affect the http calls made from this Binance client, so I would just remove it from the shared http client, and set it only for the websockets client with an appropriate value. You are right, |
|
I totally agree. 20 seconds seems far to less. |
|
It says the same for okhttp 3.X |
kaushik1979
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Can you merge it into master please?
|
It seems to me that this is still an issue and @eugenpodaru isn't active anymore. Any plans to fix this? |
What does this PR do?
Where should the reviewer start?
How should this be manually tested?
Any background context you want to provide?
According to the documentation:
The current implementation uses the same pingInterval for all clients, and it has a value of 20s. This works for a while, but then starts failing with java.net.SocketTimeoutException: sent ping but didn't receive pong within 20000ms.
Setting the pingInterval to 3 minutes as per the documentation fixes the issue. I have been running the client with the fix in production for a few days already, and have not encountered the error, while before, I would get it an hour after the app restart, and every 20 seconds after the first failure.