Unstable connection status
Hello,
I use a phone connected to wifi and also to 4G and when I cut the internet I put the two connections back in place I have a kind of unstable connection for 2 minutes or I have no reception of message.
ablyRealtime.connection.on { state: ConnectionStateListener.ConnectionStateChange -> Log.i("Ably", "ConnectionStateChange ${state.current}") }
11:22:57 : ConnectionStateChange connected
11:22:58 : ConnectionStateChange disconnected
11:22:58 : ConnectionStateChange connecting
11:22:58 : ConnectionStateChange connected
11:22:59 : ConnectionStateChange disconnected
11:22:59 : ConnectionStateChange connecting
11:22:59 : ConnectionStateChange connected
11:23:00 : ConnectionStateChange disconnected
11:23:00 : ConnectionStateChange connecting
11:23:00 : ConnectionStateChange connected
11:23:01 : ConnectionStateChange disconnected
11:23:01 : ConnectionStateChange connecting
11:23:01 : ConnectionStateChange connected
When I find the internet connection I also use this method to speed up the restoration of the channel is that it can create conflicts and cause this.
fun reconnect() {
ablyRealtime.connect()
}
I don't have this problem when I only use wifi or 4G.
Hi @WilliamDubail - thanks for reporting the issues you're facing. I hope we can get this sorted for you.
Is there any more detail you can give us, please? Specifically:
- What version of the client library are you using?
- What version of Android is the device running?
- Are you able to give us full verbose log output?
- Are you able to share any more of your code with us so we can try to reproduce the issue at our end?
More details on what we need to diagnose issues can be found here.
Thanks.
I am using version 1.2.2, I will redo the test with the latest version, I should have started there.
I did the test with a Samsung J3 Api 28 and a Huawey L29 API 29. On both phones the problem is totally identical.
For all that is code I have to look with my boss, I will repeat the test with the latest version of the library and I will try to provide you with a detailed log.
Cordially
Sorry for the waiting time a lot of work at the moment. So I tried with version 1.2.5, the problem persists. I often have this error:
I/System.out: (ERROR): io.ably.lib.realtime.Channel: Message data neither String nor byte[]. Unsupported message data type. on channel monitor_233
I have found the source of the problem I have a class which listens to the change of internet connection. as soon as I find it I call this function:
fun reconnect() { ablyRealtime.connect() }
If I comment on this function the problem goes away. Is it a mistake on my part to let Ably reconnect automatically?
Taking a quick look at this client library's implementation and reading RTN11 suggests to me that there could be undefined behaviour if connect() is explicitly called when the library is already CONNECTING.
It sounds like this is probably a bug.