Skip to content
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

wifi -> lte, when internet connection is changed, Connection timed out is occured immediately #138

Open
juceling opened this issue May 29, 2017 · 1 comment
Labels

Comments

@juceling
Copy link

hi. thank you for your library.
I have a question about reconnectivity.
when I turned off LTE and connected with WIFI, reconnection is completed.
but I turned off wifi and on LTE,

onException java.lang.Exception: com.neovisionaries.ws.client.WebSocketException: An I/O error occurred while a frame was being read from the web socket: Read error: ssl=0xae7acd80: I/O error during system call, Connection timed out

is occured immediately, 3 times.
and do not try reconnect to server.
so I inserted some code, "SystemClock.sleep(5000);", to wait establishing internet connection, and then turn off wifi and on lte.
after that, reconnection is completed.

I want to reconnect to server automatically whenever internet connection is changed. but I think if internet is not available, library don`t wait and just stop and throw above error.

how can I do this...
just check internet connection with ConnectivityManager, and control to wait to try reconnect by myself?

@ocram ocram added the question label Jun 8, 2017
@ocram
Copy link
Contributor

ocram commented Jun 8, 2017

Thanks!

Could you perhaps provide more lines from the stack trace that you quoted? It would be interesting to know where this error was caused exactly.

When you turn off LTE (where the reconnection works), has WiFi been enabled as well before so that the device can immediately fall back to WiFi? Or do turn WiFi on manually after turning off LTE?

Analogously, when you turn off WiFi (where the reconnection does not work), has LTE been enabled as well before so that the device can immediately fall back to LTE? Or do turn LTE on manually after turning off WiFi?

Maybe we can catch that exception where it is caused in the library. Otherwise, we might try to implement a short waiting time around this line which grows with the number of reconnection attempts that have been made (mReconnectAttempts). What do you think? That should be roughly what you did with sleep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants