Peer-to-peer Offline Sync for Realm

Hi all

I am trying to achieve peer-to-peer offline sync for React Native devices.

While it is possible to have a sync while online, I’m trying to figure out, when there is no internet connection. The devices are connected through wifi, but the main network can sporadically lose internet for hours. The devices should still be able to sync their realmdb.

Are there ideas how to achieve this?

Happy to open-source an adapter/layer for it.

Cheers

Welcome to the MongoDB community @Lucky_Bassi !

Atlas Device Sync currently only supports online sync with Atlas’ cloud backend. Applications using a Realm SDK write data locally on the device first, and will sync with Atlas when network access is available. Peer-to-peer offline sync is not a current feature of the Realm SDKs, but you could raise this as a suggestion on the MongoDB Feedback Engine.

Related discussion: Any known issues with manually syncing offline devices through a physical server?

Regards,
Stennie

2 Likes

Hi @Stennie_X

Many thanks for your reply!

I would really like to use RealmDB for this use-case as we have great experiences with it in the past.

Do you think it’s feasible to manually implement such a logic?

I am thinking of creating a separate collection, where:

  • unsynced data is captured for later sync to online

  • we use revisions similar to pouched and sync this over wifi to other clients

Or we could use a field within each item, where we store the sync status.

Thanks!