GrahamTheDev
GrahamTheDev

Reputation: 24825

Synchronisation of multiple off-line web pages

I am struggling with the logistics of getting a multi-device synchonisation to work.

Lets say I have an off-line web page (via app-cache) used as an address book - how would I go about structuring a robust multi-device synchronisation system.

I was thinking about the following but it doesn't seem robust:

Each device has 2 tables:

  1. 'synchronised (copy of server table at last update time) - along with the servers time-stamp at the last update point.

  2. 'awaiting synchronisation' - changes on that device waiting to be synchronised with the server. - this could have insert, delete and update items.

Then when the device connects to the server it:-

  1. Uploads all changes to the server (via a mini API) and delete them from the 'awaiting synchronisation' table.

  2. Sends the server the last synchonisation time.

  3. Then download all updates from that time onwards and add them to the 'synchronised' table on the device.

  4. Update the synchronization time. (using server time to ensure consistency across devices)

Would that work or would it fall over?

Like I said never tried a multi-device synchronisation and seems to be a hard thing to find topics on.

Finally are there any frameworks designed for this?

Anyone who has done similar with an App maybe as off-line web pages are rare - just need the logical order and any 'gotchyas' I need to be aware of.

Thanks in advance.

Upvotes: 0

Views: 32

Answers (1)

Forbesmyester
Forbesmyester

Reputation: 936

It can be tough to do that, in the end I realised that what I needed to do is create a version control system, similar to GIT... in JavaScript. Once you have the versions you can make reasoned decisions based on a change version number and the change that it was based upon.

I don't know if the project I started will be useful for you, it uses these concepts, but even if it is not I feel you should read through the documentation as it will help you think about how to tackle the wider problem. The project is stalled right now as I am looking for work (which is a lot of work) but I will be picking it up again soon.

Matt Forrester

Upvotes: 1

Related Questions