I'm continue my tests of the realm-js. I wrote little test to check synchronization with server:
'use strict';
var Realm = require('realm');
const SmsSchema = {
phone: 'string',
msg: 'string',
uuid: 'string',
status: 'int'
};
var realm;
Realm.Sync.User.login('http://xx.xxx.xxx.xx:9080','login','password', (error, user) => {
if (!error) {
realm = new Realm({
sync: {
user: user,
url: 'realm://xx.xxx.xxx.xx:9080/~/SMSService',
},
schema: [SmsSchema]
});
}
else
console.log('Connection error!');
});
realm.close();
After start of this test I have got the following exception:
Realm.Sync.User.login('http://xx.xxx.xxx.xx:9080','login','password', (error, user) => {
^
TypeError: Cannot read property 'User' of undefined
at Object.<anonymous> (/home/hermann/WebstormProjects/SMSService/app.js:15:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Can anybody help me with this error? I have to add that I never before met Node.js and and my last experience with JavaScript was more than one year ago...
via Hermann
No comments:
Post a Comment