Kucoin / kucoin-java-sdk

MIT License
89 stars 77 forks source link

ping/pong heartbeat fails, disconnecting the app from websocket #20

Closed HikaGenji closed 4 months ago

HikaGenji commented 4 years ago

the app connects to the public websocket, subscribe to some market data, e.g. ticker ETH-BTC then i get this after a few pings:

trace:

java.net.SocketTimeoutException: sent ping but didn't receive pong within 20000ms (after 0 successful ping/pongs) at okhttp3.internal.ws.RealWebSocket.writePingFrame(RealWebSocket.java:545) ~[okhttp-3.14.9.jar:na] at okhttp3.internal.ws.RealWebSocket$PingRunnable.run(RealWebSocket.java:529) ~[okhttp-3.14.9.jar:na] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na] at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

1bazinga25 commented 4 years ago

how long have you been this?

HikaGenji commented 4 years ago

since i started using the java sdk, about a week ago

1bazinga25 commented 4 years ago

I will check it with developer, please be patient to wait.

xinghui322 commented 4 years ago

Remove this code pingInterval(20, TimeUnit.SECONDS) at com/kucoin/sdk/factory/HttpClientFactory.java:32 maybe work.

1bazinga25 commented 4 years ago

Have you fixed this issue now?

denistorresan commented 2 years ago

Hi, please try to apply my PR https://github.com/Kucoin/kucoin-java-sdk/pull/56