Search code examples
realm-mobile-platform

How to include / exclude Objects from automatic Synchronization?


Im thinking about using the Realm Mobile Platform for my new application. I read the docs and found most of my requirements fullfilled like:

  • registration
  • login
  • encryption
  • self syncing
  • etc.

What I did not find is how it is decided which data is synchronized to which client. For example if you are a registered user and you login with your user account lets call it Account A. I guess all data related to Account A are now synchronizing to the Client. Now what happens if you logout with Account A and login with Account B (maybe a friend who just wants to use your smartphone for a minute) and Account B will never ever be used again on the current client. Will the automatic sync still synchronize the changes from the server to the client?


Solution

  • @Mulgard - What you are seeking is currently not possible.

    For syncronised Realms, all data is syncronised, it is not possible to selectively syncronise data records or classes.

    Authorisation to syncronsied Realms at this point is at the Realm level and not the record level, if a user has access to a Realm, then they have access to all the data in that Realm.

    There is a ticket on the GitHub project listing a selective syncronisation capability as a candidate future feature. This sounds like it might fulfil some of your requirements. https://github.com/realm/realm-mobile-platform/issues/40

    There is also a ticket on the GitHub project listing "fine-grained" permissions. https://github.com/realm/realm-mobile-platform/issues/22