NetTalk Central

Author Topic: NT10 Apps Sync Setup issue  (Read 7030 times)

de la Rosa

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • Email
NT10 Apps Sync Setup issue
« on: August 03, 2018, 07:53:52 PM »
Hi,

I tried changing the Host URL to a variable, then to a LAN IP 192.168.1.141:88 then finally back to the default http;//127.0.0.1:88 but the Log kept to the variable name and never changed Host from the default localhost:88 as you can see form the attached screen shots.

Is there anything I'm not doing right?

Thanks,
Vic

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: NT10 Apps Sync Setup issue
« Reply #1 on: August 06, 2018, 09:18:39 AM »
Hi de la rosa:
  Are you using the same machine to test the server and client?

  I think you are making the right changes, but as far i can see, your client is in the same host connecting to the 127.0.0.1 interface. Because is local, you have any problems and see in the NetTalk log the loopback IP.

  If that is the case, move the client to another PC and update the sync ip to the one you want to use.

Cheers

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT10 Apps Sync Setup issue
« Reply #2 on: August 06, 2018, 10:20:30 PM »
Hi Vic,

Unfortunately there's not a lot to go on with your report.
however, look in \web\scripts\database.js at the top, you should see your URL there.

You can't use a variable for this setting because what you enter will go directly into database.js.
You should also include the protocol (http or https) - in 10.29 it will default to https.

While you can't use a variable here, you can store the host value in a Settings table, which the user can then change. That's done with the single-record settings table.

Cheers
Bruce

de la Rosa

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • Email
Re: NT10 Apps Sync Setup issue
« Reply #3 on: August 09, 2018, 06:16:21 PM »

1. In your CIDC 2017 disconnected Web Apps training, you encountered what I was referring to you before where inserted records are not reflected on the web app, have you found the issue with it? The shipped example seems to still behave the same way.

2. I need some clarification on the syncing.
   A. In the disconnected desktop example there is a Serversync procedure with sync tables control. While it syncs when started, it does not sync when say Invoices are inserted or updated. Is it really manual mode for this example?   

   B. On the disconnected Web App. Where is the equivalent server sync procedure running? Do I need NetRefresh to fire the sync everytime a table change happens? Where can I monitor if the syncnow event is being posted?

   C. Since it did not seem to follow what I put on the Sync Host URL, what I tried was to run the server app on port 82 pointing to a server db, while the disconnected web app was on port 88 pointing to a client db on the same machine and point the sync host url to http://127.0.0.1:82. I still didn't get a sync when I tried to edit a table on the web app.

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: NT10 Apps Sync Setup issue
« Reply #4 on: August 10, 2018, 02:15:33 AM »
Hello Vic,

The disconnected desktop app and disconnected web app are two different monsters.  Both should be approached differently.  I haven't used the disconnected desktop in a while but the sync procedure can be called anytime you wish with:

Post(Event:SyncNow, ,glo:SyncDesktop.ControllerThread)

A disconnected web application will not contain a sync procedure (like the one found in disconnected desktop).  The magic in disconnected web apps happens in two JavaScript files:

database.js
nt-idb.js

I'm going off of memory so here we go.....

database.js will contain a list of all the tables in your dictionary.  You will notice that it will be declared as an object called database and then the database object will have several fields under it such as name, syncserverhost, username, password, companyname, etc.  These fields can be filled by the single record table that Bruce describes in the NT docs or you can leave them as is. 

nt-idb.js is a really cool piece of JavaScript.  Many sync actions are automated.  For example, when you open your app, it should perform a sync with the sync server.  You can make a call to one of the functions in nt-idb.js to force a sync. 

Now, if I'm off on my description, I hope Bruce claifies but that's my "off the top off my head" overview.  The disconnected web app stuff does work.  Just be patient as look over database.js and nt-idb.js closely.  Here's another tip;  In the nt-idb.js, there are many console.log('blah blah') entries spread throughout the script.  Most are commented out.  Un-comment out those console.log entries.  You can also add your own.  Now can watch nt-idb.js in action with Debugview++.  It will really help give you a better idea of what's going on.

Also, in your disconnected web app, make sure you either (1) Do not have the global nettalk Set Time Stamp extension in your app at all.  It will sync without it. OR (2) If that extenstion is in there, make sure the set ServerTimeStamp is set to false.  You want you server to set that time stamp.

I think I read the documentation about 50 times before I got my mind wrapped around how everything works.  Just know that it does work as long as everything is setup properly.  One thing to remember if you're using JSON as your return values is that JSON is case sensative. 

Good luck and I would be happy too get with you and maybe do a TeamViewer session with you to get you going.

See ya and good luck,

Don

"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

de la Rosa

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • Email
Re: NT10 Apps Sync Setup issue
« Reply #5 on: August 10, 2018, 04:59:22 PM »
Hi Don,

Thanks for the tips. Will try it out and see if I can get a handle on it.

Thanks,
Vic

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT10 Apps Sync Setup issue
« Reply #6 on: August 11, 2018, 10:43:49 PM »
Hi Vic,

Some updates in 10.29 make mobile a bit easier, and some more are coming in 10.30.

>> You can make a call to one of the functions in nt-idb.js to force a sync. 

specifically;
syncDatabase();

You can for example make that the JavaScript for a button.

Typically tables should by sync'd when they are edited. And a full sync is done very 10 mins or so (by default.)

After the current round of updates (10.30, or perhaps 10.31) I'll do a user group webinar on this so you can see some of the new stuff in action, and we'll also talk about custom javascript a bit.

cheers
Bruce




de la Rosa

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • Email
Re: NT10 Apps Sync Setup issue
« Reply #7 on: August 12, 2018, 07:24:11 PM »
Sounds good Bruce, Thanks!