Skip to content

How It Works (GlobalTimeStamp)

Aldy J edited this page Aug 9, 2019 · 3 revisions

How It Works

When starting the synchronization process, the client will upload the data changes that have happened since the last time it have synced successfully. The server will apply the received changes into its repository, and respond back to the client with changes that have happened in the server repository since the last time the client have synced. The received server changes will also be applied by the client in its local database at the end of the synchronization process. The same synchronization process also applied to other devices that belong to that particular client, therefore, each device for a single client can keep its data updated by executing the synchronization process.

Things to Note

  • As stated in the Main Page, this approach relies heavily on the correctness of each system's Date Time (world clock) that will participate in the synchronization process. On servers this may be not an issue (servers usually always have correct Date Time), but in mobile clients, if for some reason your user change the phone's date to an earlier time after synchronization, the next synchronization will have conflicts in it. So this approach may be suitable if only performed between servers.
  • This library supports PushThenPull (the client pushes the changes first to the server, and then pulls changes from server into the client) and PullThenPush (the client request changes first from the server, and then pushes its changes into the server) mechanisms, BUT, for GlobalTimeStamp, these mechanisms will not have different effect, because the data that exist in both systems will be compared with real world clock as their time stamp, so it doesn't matter who push or pull first, because conflicts that could happened during updates can be handled accordingly in the SyncEngine subclass method (during the DeserializeJsonToExistingData method). Therefore, the only supported mechanism for GlobalTimeStamp is the PushThenPull (default) mechanism.