用于在线/离线移动同步的库

发布于 2024-12-27 17:33:05 字数 580 浏览 3 评论 0原文

我正在为 Android 开发 PhoneGap 应用程序(也可以在 iOS 上运行)。

该应用程序将在线/离线。我目前正在使用 javascript / jquery 对服务器端的 WCF JSON 服务进行 ajax 调用。

这是我的同步机制。这是非常临时的,我需要从数据库表 x 同步,所以我将在服务器端编写一些代码来加载该数据并将其公开在服务上。我将在客户端编写一些代码来调用服务上的该方法并将其同步到客户端的数据库中。

确保数据不冲突几乎是您根据需要自行设计的。

只是想知道是否有任何库可以像这样同步数据?想像 SQL 复制(但不是 SQL 复制)之类的东西。

我可能会编写许多这样的应用程序,因此通用解决方案将是理想的选择。

更新:

这个问题又被提出了。为什么我们有一个 HTML5 标准,规定我们可以拥有离线数据库,并在设备上缓存 html 页面和 javascript,但我们没有一个标准的数据同步方法?

这表明我们希望能够使我们的应用程序离线。

当然,在一个简单的应用程序中这可能很容易做到,这正是我们一开始就应该开发的。

但我们将要编写的下一个应用程序将会复杂得多。

I am developing a PhoneGap application for Android (will work on iOS too).

The app will be online / offline. I am currently using javascript / jquery to make ajax calls to a WCF JSON service on the server side.

This is my sync mechanism. It's very ad-hoc, I need to sync from database table x, so I will write some code on the server side to load that data and expose it on the service. I will write some code on the client side to call that method on the service and sync it into my database on the client side.

Making sure that data doesn't clash is pretty much roll your own as required.

Just wondering if there are any libraries around to sync data like this? Think of something like SQL replcation (but not SQL replication).

I could be writing a number of applications like this, so a generic solution would be ideal.

UPDATE:

This question has been raised again. Why is it that we have an HTML5 standard which is specifying that we can have offline databases, and cache html pages and javascript on the device, but we don't have a standard way to synchronise data?

This points to the fact that we expect to be able to go offline with our applications.

Sure, it might be easy to do in a simple application which is what we should be developing at the start.

But the next app we will be writing will be a lot more complicated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

寄居者 2025-01-03 17:33:05

哎呀,没有。

有人已经对 django 提出了类似的问题:
服务器<->设备的数据同步框架/算法?

主要取决于您要同步的数据类型以及冲突解决策略。

如果您不必解决冲突,则可以使用简单的 transactionID 并在重新建立连接时重播服务器和客户端中丢失的事务。

我过去也做过一些非常临时的事情,问题是不要让每个项目的解决方案过于复杂。

afaik, there is none.

someone ask a similar question for django already:
Data Synchronization framework / algorithm for server<->device?

It mostly depends on the kind of data you want to sync, and the conflict resolution strategy.

If you do not have to resolve conflict, a simple transactionID and a replay of missing transactions in the server and the client when connection is re-establish.

I have done something very ad-hoc too in the past, problem being not to overcomplicate the solution for each project.

过潦 2025-01-03 17:33:05

我想邀请您看看开源项目 OpenMobster 的同步服务。您可以执行所有类型的同步操作(双向、单向客户端、单向设备、启动等)。除此之外,所有修改都会自动跟踪并与云同步。当网络连接断开时,您可以让应用程序离线。它将跟踪任何更改,并在连接恢复时自动在后台将其与云同步。

目前 Android 和 iOS 上仅支持本机开发。不过,下一个版本 2.2-M8 将支持 Android 上与 PhoneGap 的端到端集成,2.2-M9 将添加 iOS。

以下是开源项目的链接:http://openmobster.googlecode.com

I would like to invite you to take a look at the open source project, OpenMobster's Sync service. You can do all types of sync operations (two-way,one-way client,one-way device, bootup, etc). Besides that, all modifications are automatically tracked and synced with the Cloud. You can have your app offline when network connection is down. It will track any changes and automatically in the background synchronize it with the cloud when the connection returns.

Currently only native development is supported on Android and iOS. However, the next release which is 2.2-M8 will support end-to-end integration with PhoneGap on Android and 2.2-M9 will add iOS.

Here is a link to the open source project: http://openmobster.googlecode.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文