ansible-role-varnish icon indicating copy to clipboard operation
ansible-role-varnish copied to clipboard

For internet connection management of ConnectyCube SDK

Open xspire opened this issue 3 years ago • 14 comments

I have one suggestion for ConnectyCube SDK.

Add a management for AppLifecycleState and ConnectivityResult to ConnectyCube SDK.

This is to allow developers to determine the app state by looking only at the CubeChatConnectionState state value.

We found a situation that xmpp_stone in ConnectyCube SDK does not accurately reflect the current device state.

Sometimes, xmpp_stone is holded in a several state ( xmpp.XmppConnectionState.Authenticated, SocketOpening ... ) in a situation what internet connection is very often changed between wifi and LTE.

It is very defficult that developer manage the online connection.

Currently, is there perfect connection management solution for an unstable internet connection with ConnectyCube SDK ?

I spent too much time for stabilizing internet connection management with ConnectyCube SDK.

Ps : I use flutter Connectivity_plus plugin package for internet connection management.

xspire avatar Aug 04 '21 16:08 xspire

We provided worked example for managing Internet state in our Chat sample. Which problem do you have with this implementation?

TatankaConCube avatar Aug 04 '21 16:08 TatankaConCube

State of SDK is very often frozen in Reconnecting, Authenticated, SocketOpening,.. when changing between wifi and LET. To escape this stat, restart app. I have not yet fined a solution for this situation. I am spending 5 month for this issue.

xspire avatar Aug 04 '21 16:08 xspire

have you reviewed my link? there we try to reconnect to the chat if the chat connection state changed to Closed or ForceClosed and connectivityType != ConnectivityResult.none. Or vice versa, when the connection state is changed to connectivityType != ConnectivityResult.none we check the state of the chat connection and try to reconnect if need.

TatankaConCube avatar Aug 06 '21 07:08 TatankaConCube

Of course, I have used the activity_plus and app lifecycle hander. I mean that xmpp_stone state in connectycube api is holded freezied on a several state. FinaIly, i use watchdog to escape this situation, but the freezing state is not solved. Watchdog has been builded for checking holding state in any state what is not ready. When watchdog timeout is fired, recreate a session and chat login. I used the relogin function of connectycube sdk before, but it didn't work in any wifi, LTE situation. Also ConnectyCube SDK is freezied.

xspire avatar Aug 06 '21 07:08 xspire

@TatankaConCube xmpp_stone is not adaptive to the Wi-Fi changing situation. (ex, iphone's personal hotspot and other wifi) You should check that mismatch between CubeChatConnectionState and XmppConnectionState. How to reset xmpp_stone connection ?

xspire avatar Aug 08 '21 17:08 xspire

@TatankaConCube onConnectivityChanged handler of Connectivity does not be called when change any wifi to hotspot wifi.

Under stable wifi state, two xmpp message is periodically outputted with 5 seconds. That is "r xmlns="urn:xmpp:sm:3"" and "a xmlns='urn:xmpp:sm:3' h='69'".

But when wifi is exchanged, only one xmpp debug message is appeared. That is "r xmlns="urn:xmpp:sm:3"".

No handler is not called.

After about 3 minute, suddenly Outputing "CubeChatConnection: Chat connection ForcefullyClosed" debug message is started. After a moments, the connection is recovered.

I want to shrink the 3 minute. Where can i fix it ?

xspire avatar Aug 09 '21 10:08 xspire

@TatankaConCube Socket Timeout is estimated at 6 minute.

xspire avatar Aug 09 '21 16:08 xspire

@TatankaConCube I can't fined a timeout variable for handleSecuredConnectionError exception event what in Connection.dart of xmpp_stone. It is very serious.

xspire avatar Aug 09 '21 16:08 xspire

Before about 6 minute, CubeChatConnection.instance.login does not return or call catError. If user restart app before 6 minute, Login is success. Is this a server issue too ? Where are you ?

xspire avatar Aug 11 '21 03:08 xspire

Have you try to use method CubeChatConnection.instance.relogin instead of CubeChatConnection.instance.login? Could you please attach here full log from flutter console?

TatankaConCube avatar Aug 11 '21 15:08 TatankaConCube

relogin and login, logout function is all failed after when device's ip is changed.

I find that xmpp's _socket is not destroyed when device's ip is changed. _socket?.destroy() code is not used anywhere in xmpp_stone and connectycube sdk.

Please check https://pub.dev/packages/network_info_plus flutter plugin.

Plesase test your flutter sample and improve your sdk for a daily use. I am spending my time too much for keeping online of your sdk.

xspire avatar Aug 12 '21 16:08 xspire

Which version of our SDK do you use? How can we reproduce the same issue in our sample?

TatankaConCube avatar Aug 13 '21 08:08 TatankaConCube

I am using ConntctyCube ver 2.0.2.

Test sequence.

  1. Run your chat sample app on android phone and iphone.
  2. Check that exchanging text message is stable.
  3. Open the network control pannel of device, and change the WiFi SSID to other WiFi SSID.
  4. Try sending and receiving message.
  5. Check how long time it takes for sending and receiving messages to resume.

xspire avatar Aug 13 '21 08:08 xspire

@TatankaConCube Is there any activity ?

xspire avatar Aug 23 '21 10:08 xspire