How to synchronize data amongst devices in Wi-Fi

前端 未结 3 1895
南笙
南笙 2021-02-05 21:02

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.

3条回答
  •  萌比男神i
    2021-02-05 21:43

    I don't know about the specifics of your problem, but:

    • if you don't have A LOT of data
    • if your updates are not very frequent (> 1 req/s)

    could a broadcast UDP message work?

    If you query the network and get the broadcast address, that could be an easy way to distribute/query for information without needing to send it to each device individually. Of course, UDP is not reliable so you would need to implement some kind of "query" mechanism where the device would ask for updates once it (re)connects to a network.

    Only other, more reliable, option that I could think of would be using platform's push notifications. In that case Apple/Google will make sure your messages get delivered, your only job is to keep a list of devices in "a group" (e.g. on the same wifi). But this solution again includes having a central server and, even more, access to the internet.

提交回复
热议问题