twilio / twilio-chat-demo-android

Chat API Demo Application for Android
MIT License
62 stars 51 forks source link

Client connection state remain Connecting even after Client Synchronising completed. #90

Closed S-Saagar closed 5 years ago

S-Saagar commented 5 years ago

Hi...

I am using Twilio SDK 4.0.2/4.0.3 in both of this SDK happening this.

Currently when I'm creating a client with JWT token. After 3 to 4 time on app open facing this issue.

Like client stay in connecting state which not going to connected state even after client sync completed.

2019-02-25 17:46:56.430 18740-18740/blitzz.co.blitzztest I/TwilioSingleton: connectToChatClient():: triggered 2019-02-25 17:47:00.891 18740-18740/blitzz.co.blitzztest E/TwilioSingleton: Client connection success 2019-02-25 17:47:00.891 18740-18740/blitzz.co.blitzztest E/TwilioSingleton: onClientSynchronization: CHANNELS_COMPLETED 2019-02-25 17:47:00.893 18740-18740/blitzz.co.blitzztest E/TwilioSingleton: Chatclient state is:: CONNECTED 2019-02-25 17:47:10.355 18740-18740/blitzz.co.blitzztest E/TwilioSingleton: Chatclient state is:: CONNECTING 2019-02-25 17:48:42.125 18740-18740/blitzz.co.blitzztest E/TwilioSingleton: onClientSynchronization: COMPLETED

I'm following your demo from git hub.

berkus commented 5 years ago

Hi!

Unfortunately, due to asynchronous design of our libraries, it may happen that these events will arrive out of order. That's the way how we designed it. But we agree that it's not convenient for the end-customers and we will fix this in the future.

For now,

2019-02-25 17:47:00.893 18740-18740/blitzz.co.blitzztest E/TwilioSingleton:
Chatclient state is:: CONNECTED
2019-02-25 17:47:10.355 18740-18740/blitzz.co.blitzztest E/TwilioSingleton:
Chatclient state is:: CONNECTING

If you received a CONNECTED event, you can ignore all other states coming within short period of time from this first one (lets say 30s to a minute).

S-Saagar commented 5 years ago

I have tried that. But when client in connecting state and try to get chat message from channel it gives me error. channel.getmessages() method give me null value.

berkus commented 5 years ago

Interesting, so it may actually be not connected.

Could you please collect the full log when this error happens?

S-Saagar commented 5 years ago

Here is text log file.

https://drive.google.com/open?id=1lVg9bWeYC-Xc2ajOmswNbgPZKDg3UrIa

S-Saagar commented 5 years ago

@berkus

Any workaround for this issue?

berkus commented 5 years ago

@S-Saagar please provide the logs as described in this link. Namely, use the Log.VERBOSE log level.

berkus commented 5 years ago

No response in 3 weeks, closing.