I'll-Be-Back
I'll-Be-Back

Reputation: 10828

Synchronization between mysql and IndexedDB

I like to develop an Desktop App using nw.js (node-webkit) or Electron.

I am looking for a solution to sync between IndexedDB and MySQL Server + PHP(Laravel) on the cloud via Restful API.

PouchDB look good but that is out of option because it only support to sync with CouchDB.

What option do I have?

Upvotes: -1

Views: 2239

Answers (1)

David Fahlander
David Fahlander

Reputation: 5646

It's possible with dexie but not as complete as you get with pouchdb. The closest you come to a complete solution with dexie is using the Dexie.Syncable addon (https://dexie.org/docs/Syncable/Dexie.Syncable.js) and implement the backend from the following 2 backend sample implementations:

https://github.com/dfahlander/Dexie.js/tree/master/samples/remote-sync/

If you don't want to rely on Dexie.syncable, another solution would be to build your own sync addon based on the stable CRUD hooks that Dexie provides in it's default api:

https://dexie.org/docs/Table/Table.hook('creating')

https://dexie.org/docs/Table/Table.hook('updating')

https://dexie.org/docs/Table/Table.hook('deleting')

Using those hooks, may log all local changes to a dedicated table for syncing with server when it goes online. This is what Dexie.Syncable is based on.

Upvotes: 1

Related Questions