Realm Sync - A Primer

Quick overview how Realm Sync works

Realm Sync lets you seamlessly share data between devices in a way that is connectivity-tolerant, for instance, where there is poor connectivity with high latency or if you are entirely offline. This enables you to give clients the optimal user experience, interacting with data locally with zero latency.

It does this by introducing the concept of a “realm”. A realm is a lightweight container of interconnected objects, which can be shared concurrently across multiple devices. Every realm has its home on a Realm Object Server (which can contain any number of realms), and has a URL which uniquely identifies it. This URL can be used to open the realm in a way very similar to how you would open a web page in a browser, except in this case you are getting live objects, rather than a static HTML document.

When you open a realm on a device, the objects it contain will be replicated from the server to the device or vice versa, so that you have them available locally which means that you always have zero-latency access to them and that the app will keep working even if it goes online. Any changes done to the objects in the realm will eventually be reflected in the all other instances of the same realm on other devices. If only one client syncs with the server, then essentially the server captures as digital twin of the state of the synced database from the client - convenient for example for IOT use cases.