ably-java icon indicating copy to clipboard operation
ably-java copied to clipboard

Unstable connection status

Open WilliamDubail opened this issue 4 years ago • 4 comments

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.

┆Issue is synchronized with this Jira Task by Unito

WilliamDubail avatar Mar 15 '21 10:03 WilliamDubail

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:

  1. What version of the client library are you using?
  2. What version of Android is the device running?
  3. Are you able to give us full verbose log output?
  4. 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.

QuintinWillison avatar Mar 15 '21 10:03 QuintinWillison

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

WilliamDubail avatar Mar 16 '21 07:03 WilliamDubail

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?

WilliamDubail avatar Mar 29 '21 08:03 WilliamDubail

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.

QuintinWillison avatar Apr 12 '21 15:04 QuintinWillison