Data synchronization


#1

Hi,

I created a simple app for storing lists and with some items and now I want to synchronize it with the ROS. It creates realm which I see in realm studio, but it does not have any schemas defined and no records there.

Also, I get such errors in console:

error: [sync] Sync Connection[71]: Session[1]: Token expired (signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[71]: Session[1]: Token expired (message_type='bind', signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[72]: Session[1]: Token expired (signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[72]: Session[1]: Token expired (message_type='bind', signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[73]: Session[1]: Token expired (signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[73]: Session[1]: Token expired (message_type='bind', signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[74]: Session[1]: Token expired (signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[74]: Session[1]: Token expired (message_type='bind', signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[75]: Session[1]: Token expired (signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').
error: [sync] Sync Connection[75]: Session[1]: Token expired (message_type='bind', signed_user_token='...pOxbcbv+ew2OZLyghvrjDflgQLeg==').

Here is my code:

import { Object as RealmObject } from 'realm'

class List extends RealmObject {
  static schema = {
    name: 'List',
    properties: {
      title: 'string',
      list_items: {
        type: 'list',
        objectType: 'ListItem',
      }
    }
  }
}
class ListItem extends RealmObject {
  static schema = {
    name: 'ListItem',
    properties: {
      title: 'string',
      category: {
        type: 'string',
        optional: true,
        indexed: true,
      },
      completed: 'bool'
    }
  }
}

Realm.Sync.User.login(REALM_SERVER_URL, 'realm-admin', '').then(user => {
  Realm.open({
    sync: {
      user: user,
      url: `realm://${REALM_HOST}/~/testRealm2`,
    },
    schema: [List, ListItem]
  }).then(realm => {
    realm.write(() => {
      const list = realm.create('List', {
        title: 'NewList'
      })
    })
  })
})

#2

Fixed by upgrading to [email protected] Upgrading to 2.0.8 brokes app. I’ll create an issue a bit later.


#3

From the console errors, it appears that the token is expired. This means the server will reject the schema
and the data from the client.

Make sure you are logged in.


#4

I see exact the same with realm Studio 1.9.1 (on Windows 10), realm for .net 2.1.0 and a fresh install on linux with ros version 2.0.23.
The objects are in the object store; but not the schemas; added [MapTo] - doesn’t make a difference; on SyncConfiguration.ObjectClasses added the classes; no difference; anything i overlook ?


#5

Hi,

I am trying to sync from my local realm object file to ROS. I had created a UWP app, with the functionality that you could examine (Github). There is the file with all Realm logic (https://github.com/Keinier/realm-sync-uwp/blob/master/Realm-Sync/ViewModels/StartPageViewModel.cs).

When I run the app, the sync process executes perfectly without errors but when I check the ROS object I see that a new schema has been created but any object. The schema is empty. I do not know why.

Do you know something about?

Thanks!