2 / 2
Jul 2024

Question regarding Realm SDK for React Native initial subscription, in documentation I found “By default, Realm syncs all data from the server before returning anything.” Does that mean that setting up initial subscription for flexible sync just creates top level query to pull from the data that’s already on the device?

Thanks in advance.

Hello,
When using the Realm SDK for React Native with Flexible Sync, the default behavior is to synchronize all data from the server before returning anything to the client. However, let’s dive into the details:

Default Behavior:
By default, when you set up a synced realm, Realm ensures that all data from the server is synchronized to the client before any data is returned.
This means that when you query the realm, you’ll receive the most up-to-date data available on the server.
Initial Subscription:
When you create an initial subscription (such as setting up a query), it doesn’t directly create a top-level query to pull data from the device.
Instead, it defines what data you’re interested in. The actual synchronization happens in the background, ensuring that the data you’ve subscribed to is kept up to date.
Flexible Sync:
Flexible Sync allows you to synchronize data between many devices, each with its own local copy of the data.
You can configure subscriptions to specify which data you want to synchronize. These subscriptions define the queries that determine what data is pulled from the server to the client.
Remember that Flexible Sync is a powerful feature that allows you to tailor your data synchronization based on your application’s needs.

Hope this work for you.
Best regards,
florence023