-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onDisconnect/onError not called #113
Comments
This is really necessary. I know you can do it, need just little change in the code. Other options you suggested earlier just doesn't work on any platform. They are just temporary solutions. |
Please point to the source code in OkHttp which detects disconnection of WiFi. I want to know how OkHttp achieves it. Also, please send me a pull request containing the little change that you think can detect disconnection of WiFi. |
Hey, I think it doesn't work in OkHTTP also. It's old socket problem, even in raw java sockets. Can it be effectively handled by using ping- pong mechanism? I think max delay of 2 sec should be allowed to detect socket disconnection? Can you show me the effective code to implement it? |
// Get a WebSocket instance from somewhere.
WebSocket ws = ...;
// Send a ping per 2 seconds.
ws.setPingInterval(2 * 1000); Please read "Send Ping/Pong Frames Periodically" in README.md. |
I noticed that onDisconnect is also not called in case the websocket server goes offline (switched off). Is this normal? Do I need to use pings? (A little bit more information on the purpose of Pings and Pongs would be cool!) |
I think most of the people must have opened this type of issue. Whenever I shut down my wifi and internet is not available, dis-connect event is not getting fired. This is really a serious issue and must be solved. It's the primiary basic feature provided by socket and must call disconnect event when network goes off. The issue is not just in android but also in simple cmd APIs.
I think it works perfectly in OkHTTP, Then it should also be supported in this library.
The text was updated successfully, but these errors were encountered: