【问题标题】:Synchronization between mysql and IndexedDBmysql和IndexedDB之间的同步
【发布时间】:2016-10-21 16:08:08
【问题描述】:

我喜欢使用 nw.js (node-webkit) 或 Electron 开发桌面应用程序。

我正在寻找一种解决方案,通过 Restful API 在云端的 IndexedDB 和 MySQL Server + PHP(Laravel) 之间进行同步。

PouchDB 看起来不错,但这是不可行的,因为它只支持与 CouchDB 同步。

我有什么选择?

【问题讨论】:

    标签: javascript php indexeddb pouchdb dexie


    【解决方案1】:

    dexie 可以,但不如 pouchdb 完整。最接近 dexie 的完整解决方案是使用 Dexie.Syncable 插件 (https://github.com/dfahlander/Dexie.js/wiki/Dexie.Syncable.js)(尚不稳定)并从以下 2 个后端示例实现中实现后端:

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

    如果您不想依赖 Dexie.syncable,另一种解决方案是基于 Dexie 在其默认 api 中提供的稳定 CRUD 挂钩构建您自己的同步插件:

    https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27creating%27)

    https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27updating%27)

    https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27deleting%27)

    使用这些钩子,可以将所有本地更改记录到专用表中,以便在服务器上线时与服务器同步。这就是 Dexie.Syncable 的基础。

    【讨论】:

    • 感谢您的回答。您认为 Dexie.Syncable 何时会稳定并准备好投入生产?
    猜你喜欢
    • 2016-03-31
    • 2012-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-29
    • 1970-01-01
    相关资源
    最近更新 更多