Adding ROS functionality to my App (react native)

ros

#1

Hi,

I started building my app using local realm.
All the class definitions and schemas (models) are defined in the app code.

I instaled ROS and want to unleash its features of sync.

Assuming I wish all my local realm data to be synced - how do I do that ?

do I need to rebuild the data structure in ROS? if so how ?
Cant I just initiate a sync via the app using the ROS admin code and it will duplicate automatically the structure ?

im quite confused.Will appreciate any help

Thank you
Yuval


#2

@yuvalkro The first step would be to pass a SyncConfig into the realm open API

But this really depends on the structure of your app and how you want to sync data and share the data with other users.


#3

Hi Ian,

Thank you for your quick reply.
I have multiple data objects.
Some will be local, some public and some shared between several users.
As a test case I want to start with the easy ones - the public .
Lets assume I have currently 2 data objects - makers and models which exist locally and i wish to make them public (i.e move them to ROS so they can sync with all connected devices).

How do I create then on the ROS ? I alreday have their schema definitions in my code .
I tried to build them manually on the ROS using the desktop gui but found it not stright forward ( didnt find a way to make a property with back link for example).
Second question is how do I populate these objects on the ROS.

Many thanks

Yuval


#4

hey @yuvalkro You cannot mix local and synced realms - so any data you want to be synced will need to be in a different realm with a syncConfig. You can then copy any data you need from the local to the synced realm for it to sync to ROS

You can have the syncUser be an admin and then you can specify the URL and it should be generated for you on the ROS


#5

Thanks Ian,

Different realms - understood.

I still cant figure how to copy data (or model structure) to ROS.
you wrote :

You can have the syncUser be an admin and then you can specify the URL and it should be generated for you on the ROS

I logged in (in the mobile app) using realm-admin user and ROS url but recieved back undefined for the realm.

Maybe there is a code example somewhere you can point me to ?

much appreciated

Yuval

p.s. Just found below link (written by you)

https://realm.io/docs/cookbook/js/local-realm-to-synced/

But it throws me an error

“Schema validation failed due to the following errors : Property ‘Model’ of type ‘Object’ has unknown object type ‘linking objects’”

I noticed that also the Realm Studio doesnt support the option to add linking Objects property…
is that a known limitation of ROS?


#6

@yuvalkro How are you trying to open the Realm? Any logs when you try to open?

There is an example app here you can walk through:
https://docs.realm.io/cloud/ios-todo-app


#7

***** UPDATE- issue is solved by upgrading the realm to the latest version version *****

Hi Ian,

Thank you, I managed to open a synced realm.
At the moment the issue is that using the Realm Studio I can see the sync realm in the list but once I open it via the GUI it has no data inside and no associated schemas although in the configuration file I defined the schemas (I can also see that the schemas exist in the realm via the debugger tool) and later populated it with data.
I do the write using the default realm-admin user .

Permission issue? any idea?

Thanks,

Yuval