-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simperium backend stops syncing to IOS client with toggling value (heartbeat implementation) #558
Comments
One more addition that may be useful: when on the same object we make a change to another attribute than the 'heartbeat' attribute from the web app (via JS client), this other attribute is correctly updated. Current code on IOS client does not change any other attribute so we cannot test if that syncing works still. |
Hello there @bayareacoder, Simperium was really designed to isolate you from those details. Internally, it already has a heartbeat (check here). If you still need to check the internal state, you could rely on this property to get the "Last Seen Time". If the "Heartbeat Use Case" is to detect which clients are online (Web / iOS), you could, instead, try using presence, which is a way better approach. It's described in this tutorial, but long story short, you enable it via a REST call, and any objects you insert in a given bucket, will be deleted whenever a client disconnects. Regarding the Out of Sync issues you mention, please, try enabling verbose logging, and check the logs whenever your app stops sync'ing. If / when that happens, please, make sure to also check the Hope that helps! |
Thank you for the detailed reply! One thing we need to capture is an app crash in which case there will not be a call to the Simperium 'signout' method. Will the server remove these objects then as well - I assume yes since removal by the server relies on not receiving the heartbeat anymore you put in the connection? Pls confirm. We've only seen our 'heartbeat' implementation stop syncing after a long time (sometimes days) so it's a bit difficult to capture the logs and find the exact time it happens. Was there ever a resolution to #293 - the issue was never closed from 2 yrs ago? |
@bayareacoder awesome, glad to hear it was useful! Whenever the client disconnects / signs out, the presence data should be cleared out, indeed. Regarding #293, i'm afraid the issue was never really addressed. Nevertheless, it's a different scenario from yours. The backend side rejection was caused by a schema enforcement policy being tested (during development), and it's something that shouldn't happen in real-life usage. If you ever manage to retrieve the verbose log for this glitch, please, feel to reopen this issue. Thank you for helping us out!! |
We use IOS client v0.8.17 and implement a heartbeat function in the app by toggling a Boolean between true and false every 5 seconds (CoreData makes this an NSNumber that toggles between 0 and 1 I believe). We detect the toggling value in our web app via your JS library as proof that the IOS client is online.
What we see is that after some time (can be a few days) the value is not toggling anymore although the IOS app is active. On the Simperium website the value is no longer toggling either so it seems an issue between IOS client and your backend.
There seem to be similar issue reports (e.g. #293) of sync stopping after certain conditions.
Is there a root cause of this & a solution, or another way to implement a heartbeat function?
The text was updated successfully, but these errors were encountered: