SynchroLabs / SynchroServer

The Synchro Server platform
https://synchro.io
1 stars 2 forks source link

Need mechanism to detach state manager on app exit #44

Closed BobDickinson closed 8 years ago

BobDickinson commented 8 years ago

When running an app from Synchro Explorer and navigating back to the launcher, and even into another app, a single state manager stays connected at the client level. This means that you can get notifications from a Synchro app that is no longer running, which is problematic.

For example, when navigating out of Drinkro back to the launcher, then back into another app, you can still be getting polling updates from the Drinkro app, and those polling updates are received by the state manager and processed. In the Drinkro case, the response causes a re-poll, and that continues indefinitely, even when you are at the launcher or in another app.

We could use some kind of app identifier (a guid, or possible just the endpoint) to determine if a client transaction applies to the current app, and if not, to ignore that transaction. Or alternatively, we could shut down the state manager when exiting an app and create a new one for subsequent Synchro apps when they run.

BobDickinson commented 8 years ago

The new back support addresses this. By having an "exited" state in the state manager, that will cause all connections to resolve/complete, and should result in the StateManager being able to be GC'd.

The web client is the exception to this rule, since we don't really have control over back navigation (out of the app). In that case, when navigating out of the app, everything goes away (so there is not StateManager to detach).