Search code examples
mysqlhtmlsynchronizationweb-sql

WebSQL and MySQL synchronize


My HTML5 application stores all the local data in WebSQL. My server are using PHP and MySQL. Is there a method to synchronize the data both in local WebSQL and remote MySQL? Thanks very much !


Solution

  • The best way to automatically synchronize a local WebSql database (SQLite of the browser) with a server should be this repo WebSqlSync.

    Features :

    • 2 way sync : client <-> server
    • Incremental synchronization (send only the necessary data)
    • Works offline. All data changes are tracked and synchronized with the server once the connection returns
    • Support for replicating changes to multiple devices
    • Support for Basic Authentication
    • works with any JS web app or phonegap app (iOS, Android, etc.), without changing your code
    • only 4kb gziped (and no dependencies)
    • MIT licence

    Installing : Just copy the src/webSqlSync.js file in your project and include it in your html :

    <script src="lib/webSqlSync.js" type="application/x-javascript" charset="utf-8"></script>