Posts

Showing posts from August, 2013

Synchronization algorithm for exchanging data in the “Client – Server” model via REST API

Image
Many mobile applications require to sync data with a server if they operate in the client – server model to exchange data with the central repository. If the server serves up resources through a REST API , then all sync logic can be handled on the client side. The sync logic is able to handle bi-directional sync between central server and multiple clients where only incremental changes apply on both sides with some conflict detection. Each table (both server and client) participating in the sync process should include two additional fields: “ Ts ” as Number , “ Deleted ” as Boolean . The Ts  field is maintained by the server side. For example SQL Server automatically generates a unique incremental value on each insert or update. The Ts field is used to determine whether one record in the table was modified more recently than another so to download only the incremental changes. Also it will help to identify the new records created on the client as they will have no Ts value.