Reputation: 13501
I am developing a PhoneGap application for Android (will work on iOS too).
The app will be online / offline. I am currently using javascript / jquery to make ajax calls to a WCF JSON service on the server side.
This is my sync mechanism. It's very ad-hoc, I need to sync from database table x, so I will write some code on the server side to load that data and expose it on the service. I will write some code on the client side to call that method on the service and sync it into my database on the client side.
Making sure that data doesn't clash is pretty much roll your own as required.
Just wondering if there are any libraries around to sync data like this? Think of something like SQL replcation (but not SQL replication).
I could be writing a number of applications like this, so a generic solution would be ideal.
UPDATE:
This question has been raised again. Why is it that we have an HTML5 standard which is specifying that we can have offline databases, and cache html pages and javascript on the device, but we don't have a standard way to synchronise data?
This points to the fact that we expect to be able to go offline with our applications.
Sure, it might be easy to do in a simple application which is what we should be developing at the start.
But the next app we will be writing will be a lot more complicated.
Upvotes: 3
Views: 2127
Reputation: 1027
I would like to invite you to take a look at the open source project, OpenMobster's Sync service. You can do all types of sync operations (two-way,one-way client,one-way device, bootup, etc). Besides that, all modifications are automatically tracked and synced with the Cloud. You can have your app offline when network connection is down. It will track any changes and automatically in the background synchronize it with the cloud when the connection returns.
Currently only native development is supported on Android and iOS. However, the next release which is 2.2-M8 will support end-to-end integration with PhoneGap on Android and 2.2-M9 will add iOS.
Here is a link to the open source project: http://openmobster.googlecode.com
Upvotes: 1
Reputation: 14197
afaik, there is none.
someone ask a similar question for django already: Data Synchronization framework / algorithm for server<->device?
It mostly depends on the kind of data you want to sync, and the conflict resolution strategy.
If you do not have to resolve conflict, a simple transactionID and a replay of missing transactions in the server and the client when connection is re-establish.
I have done something very ad-hoc too in the past, problem being not to overcomplicate the solution for each project.
Upvotes: 1