delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

Meteor reconnects and updates db in recursion #114

Closed maximsushkevich closed 7 years ago

maximsushkevich commented 7 years ago

Hi there!

I found the very strange behavior. Meteor rewrites local db in recursion.

Investigating this issue I have found in log following lines:

Meteor
   onClose

ddp lib prints this lines onDisconnected.

Looks like meteor connects, updates local db, disconnects then connects again, updates local db, again disconnects ...

Did anybody meet the problem such this? Could be problem in socket library?

Since I work with wss, I have replaced https://github.com/ngauthier/tubesock with https://github.com/TakahikoKawasaki/nv-websocket-client.

Thank you!

ocram commented 7 years ago

Thanks for your report!

Did you replace firebase/TubeSock with TakahikoKawasaki/nv-websocket-client in the version of your application that produced the problems? If so, I'm afraid we can't do anything here, unless you can re-produce the same problems with the former library.

However, I'd love to get your feedback when we do the switch to TakahikoKawasaki/nv-websocket-client soon, which is very likely.

maximsushkevich commented 7 years ago

Looks like the problem was because I didn't use meteor disconnect. I have added disconnect to activity on destroy and looks like everything is ok. But it is very strange. When I used disconnect in on pause and connect on resume connection didn't worke properly.

I have found one more strange issue: to get information from server I need subscribe to necessary data after each request. It is very strange. Is way to check subscriptions?

Thank you!

ocram commented 7 years ago

Looks like the problem was because I didn't use meteor disconnect.

Glad to hear that, thanks for resolving this issue!

When I used disconnect in on pause and connect on resume connection didn't worke properly.

That's strange, indeed. As you assumed, it should really work in both scenarios, when you connect/disconnect in onCreate/onDestroy or when you do so in onPause/onResume.

to get information from server I need subscribe to necessary data after each request. It is very strange. Is way to check subscriptions?

What do you refer to with "each request"? Do you experience that you have to re-subscribe after every re-connect? That's plausible, since subscriptions are only kept if the session is not lost.

ocram commented 7 years ago

There are some news in https://github.com/delight-im/Android-DDP/issues/101 that might be relevant.