TakahikoKawasaki / nv-websocket-client

High-quality WebSocket client implementation in Java.
Apache License 2.0
2.03k stars 292 forks source link

Websocket disconnects automatically after 30 seconds #243

Open mohammadmirdar opened 1 year ago

mohammadmirdar commented 1 year ago

Hi! I have an issue with this library. It disconnects after 30 seconds. I also tried to setPingInterval to 60 seconds but it closed automatically with close error 1000.

kvhadzhiev commented 1 year ago

Try setting the underlying TCP connection's timeout through WebSocketFactory.setConnectionTimeout()

Check if the software at the other end of your WebSocket channel has configurable ping interval (for example, browsers might not support it).

Finally, check if some firewall is killing idle connections.

mohammadmirdar commented 1 year ago

Thanks for your answer. I implemented this library in android and set all of this methods that you mentioned. but still, i see that socket disconnects after 30 seconds

kvhadzhiev commented 1 year ago

It could be something Android specific then. Here is SO question and solution regarding a similar 30 seconds disconnect on Android.