如何在Wi-Fi中的设备之间同步数据 [英] How to synchronize data amongst devices in Wi-Fi

查看:152
本文介绍了如何在Wi-Fi中的设备之间同步数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发适用于iOS和Android的应用。基本功能是在没有中央服务器的情况下,在Wi-Fi网络中的所有设备之间保持一定数据集同步。每个设备都可以修改该组数据。

I am developing an app for iOS and Android. The basic functionality is to keep a certain set of data synchronized across all devices in a Wi-Fi network without a central server. Every device can modify that set of data.

目前的方法是通过Bonjour / Zeroconf发现其他设备,然后通过ZeroMQ向所有设备发送更改消息 。

The current approach is to discover the other devices via Bonjour/Zeroconf and then send the "change messages" to all devices via ZeroMQ.

由于两个框架都会导致很多问题的实现,我想问这是否是实现这一目标的正确方法。

As both Frameworks cause quite a lot of problems to implement I am asking if this is the correct way to accomplish this.

我将大部分逻辑实现为Bonjour和HTTP-Requests发送到所有设备。问题只是网络请求,即使经过三次尝试也无法收到,因为网络出现故障。我希望对某种状态或更可靠的消息传递框架进行某种重构。

I had most of the logic implemented with Bonjour and HTTP-Requests sent to all devices. The problem was simply network requests which would not get received even after three tries because the network failed. I want to have some kind of reconstruction of a general state or a more reliable messaging framework.

某种Gossip方法可以传播信息以及发现所有设备更好吗?

Would some kind of Gossip approach to spread the information as well as discover all devices be better?

推荐答案

让客户端 - 服务器工作可靠地工作可能非常具有挑战性。特别是跨平台;似乎总有一个需要解决的边缘案例。我建议使用现有的库,而不是重建轮子,其他人已经解决了所有的问题。我还没有将它用于原型以外的任何东西,但 AllJoyn开源项目看起来非常有希望。另一种选择是 Google Nearby API ,目前仅适用于Android和iOS。

Getting client-server stuff working reliably can be quite challenging. especially cross-platform; there always seems to be one more edge-case that needs to be resolved. Rather than rebuilding the wheel, I recommend using an existing library where someone else has already worked out all the kinks. I haven't used it for anything beyond a prototype yet, but the AllJoyn open-source project looks very promising. Another option is the Google Nearby APIs, which at the moment are only for Android and iOS.

这篇关于如何在Wi-Fi中的设备之间同步数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆