NetTalk Central

Author Topic: Sync in PWA/disconnected app  (Read 4781 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Sync in PWA/disconnected app
« on: March 29, 2019, 12:43:46 PM »
     I have been testing my NT11.07/C11 PWA app locally until today.  I copied all to my server and started testing on my desktop and iPhone.
     On the desktop, I keep seeing errors as seen in the image sync.png.  It refers to a sync method at the local address of 127.0.0.1:88.  I have changed this in the global NetTalk template as seen in image pwa_apps.png.  I don't think there are any other references to the local address. Perhaps it is in the Device file?  Still searching.
     In addition, even though I moved the local tps files, which contain data, to the server, when I run this app I don't see any data.  I can insert a new record but the browse always comes back empty.
 Any thoughts?

Thanks,

Jeff

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Sync in PWA/disconnected app
« Reply #1 on: March 29, 2019, 05:51:19 PM »
Bruce,

     I think this has settled down and I do seem to see some syncing...see the image DLL_vs.png.  However, I'm only seeing data in the ThisDevice.tps file.  No data is being saved to my CoinCollection.tps file.
     I have tried this with the CoinCollection3  app as a stand-alone exe app and as a dll in the Multi-site host.  In both cases I can see the app in a local browser or in the iPhone browser.  However, no data is being saved when I do an insert.
     In the Multi-site host scenario, I tried placing a copy of the manifest.json and serviceworker.js files in the host.exe web folder to see if that made a difference, but it did not.  I assume for the Coincollector3 PWA app, that these files should be in the CoinCollector web folder, but it was worth a try.
     If I go back to running the server app on my local machine and access it via 127.0.0.1:88, it all works as it has been.  I'm not trying to use the secondary FilterForm procedure at this point, just trying to get this to work as a dll in multi-site host and test what I have on my iPhone.  Once again, very frustrated with how difficult all this has become.  Any thoughts?

Thanks,

Jeff
« Last Edit: March 29, 2019, 05:53:02 PM by jking »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Sync in PWA/disconnected app
« Reply #2 on: April 01, 2019, 05:13:11 AM »
Hi Jeff,

Bear in mind that the "database" in the browser is firmly linked to the address. So accessing 127.0.0.1 and api.jeff.com will result in (effectively) 2 completely separate databases in the browser.

As always the Developer Tools in the browser are your friend and really important for debugging. They allow you to see what (if any) errors are occurring in the console, but they also allow you to inspect the data for the database, for that address. You're able to remove the database from the browser (sometimes a good thing to do in testing) and also to inspect the database to see if the sync is working etc.

As with all programming there is an element of frustration when it doesn't work - but at the same time if you follow the data you should be able to see where your local setup, and the foreign setup differ.

Also - if you've used a "this device" table bear in mind that it'll contain data (like the host address) so you need to check the server to make sure it's set right, and also check the local database to see that it's right.

Frustration is usually caused by a misunderstanding of how all the moving parts plug together - resulting in a result different from an expectation. If you're in doubt about how it all plugs together feel free to ask. (especially in a webinar so I can show you.)

cheers
Bruce