Sync indexedDB with mysql database

blaise picture blaise · Aug 16, 2013 · Viewed 8k times · Source

I am about to develop an application where employees go to service repair machines at customer premises. They need to fill up a service card using a tablet or any other mobile device. In case of no Internet connection, I am thinking about using HTML5 offline storage, mainly IndexedDB to store the service card (web form) data locally, and do a sync at the office where Internet exists. The sync is with a MySQL database.

So the question: is it possible to sync indexedDB with mysql? I have never worked with indexedDB, I am only doing research and saw it is a potential.

Web SQL is deprecated. Otherwise, it could have been the closer solution.

Any other alternatives in case the above is difficult or outside the standard?

Your opinions are highly appreciated.

Thanks.

Answer

Carlhako picture Carlhako · Aug 20, 2013

This is definitly do able. I am only just starting to learn indexeddb the last couple of days. This is how I would see it working tho. Sorry dont have code to give you.

  1. Website knows its in offline mode somehow
  2. Clicking submit form saves the data into indexeddb
  3. Later laptop or whatever is back online or on intranet and can now talk to main server sends all indexeddb rows to server to be stored in mysql via an ajax call.
  4. indexeddb is cleared
  5. repeat