Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to synchronize HTML5 local/webStorage and server-side storage? [duplicate]

Possible Duplicate:
Best way to synchronize local HTML5 DB (WebSQL Storage, SQLite) with a server (2 way sync)

I'm currently seeking solutions for transparently and automatically synchronizing and replicating across the client-side HTML5 localStorage or web storage and (maybe multiple) server-side storage(s) (the only requirement here that it should be simple and affordable to install on a regular hosting service).

So do you have any experience with such libraries/technologies that offer data storage which automate the client-server storage synchronization and allow data to be available either offline or online or both? I think this is a fairly common scenario of web applications supporting offline mode...

like image 791
thSoft Avatar asked Apr 13 '10 15:04

thSoft


3 Answers

I just found a quite new framework which does just that: Impel.inTouch. Its schema definition seems a bit inconvenient, but definitely worth a try.

like image 92
thSoft Avatar answered Sep 30 '22 23:09

thSoft


It kind of depends on what you want. There is a great tutorial to get you started at http://hacks.mozilla.org/2010/01/offline-web-applications/ Unless you want to do something complicated, you should not need that much of a framework to do it for you. I guess you could save a few lines of code on the client using jQuery. You basically want to keep in your store a record of when the last change was made to the store, when the last update was to the server, and use send the localStorage variable encoded as JSON in an XHR (or just the bit of the local store you want to send). Then, on the server, you can decode the JSON and do what you want with it, processing it or just using PHP's serialize to dump it to a database.

If you have something particular in mind, do mention it.

like image 27
Nicholas Wilson Avatar answered Sep 30 '22 23:09

Nicholas Wilson


this question is rather similar.

There, 'quick connect' - http://quickconnect.pbworks.com/Using-Enterprise-Synchronization and my personal favorit 'persistenceJS' - https://github.com/zefhemel/persistencejs are recommended.

As soon as I gather personal experience, I'll update this post.

like image 43
TinkerTank Avatar answered Sep 30 '22 21:09

TinkerTank