Actually, I figured it out and have it syncing now:
Should have been
Sorry, here it is formatted:
Hi,
I think that I almost have it but am getting an error and I think that it is because I am a total newbie at AB and need to define CouchDB somewhere?
- In the View/Show code I have added the following line below 'window.App.RootScope.PouchDB = new PouchDB('books');':
- I have created a new button called 'sync' for testing and it calls a function called 'remoteSync'
- The remoteSync function code is:
When I press the sync button, I get the following error in the chrome console:
It feels like I am close but need a small hand. I can send you the version if it helps.
Cheers,
Pete
Hi,
I think that I almost have it but am getting an error and I think that it is because I am a total newbie at AB and need to define CouchDB somewhere?
- In the View/Show code I have added the following line below
- I have created a new button called 'sync' for testing and it calls a function called 'remoteSync'
- The remoteSync function code is:
When I press the sync button, I get the following error in the chrome console:
It feels like I am close but need a small hand. I can send you the version if it helps.
Cheers,
Pete
p.s. I tried temporarily swapping the CouchDB url into the PouchDB url and it does read/write to the remote database so I can connect to it so I just need to get the syncing working.
You configure the cors settings at an account level in ibm cloudant and it is set to allow requests for all domains. My first example must have referenced an earlier end point that I was playing with but it would have referenced the same account/cors settings. I will try the new end point in your example to see if I get the same authentication error
If you are interested in seeing an html/js example that does sync you can download it here: https://mymarina.online/iPort/getting-started-todo-master.zip It needs to be run in a local server to run.
Yes, I am speaking about the sync method. I realize that the sync function was not in the example that I had sent but I have other examples that do reference it and they do work. The implementation seems like a more simple task than the way that you tried it so I am hoping to port over the other example method into the one that I sent you to get it working today.
Pete
Hi Paolo,
Good spot on the version. I was working from a sample that I downloaded and didn't realize that it was shipped with an older version. I will try the latest version today and see how I make out.
I do have a local CouchDB server installed but have been working with IBM Cloudant and it is working on several other downloaded html/js examples that I have downloaded and configured. I will check the CORS permissions but I think that I had them set to be wide open.
I am working on the CouchDB syncing today so I will let you know how I make out.
Cheers,
Pete
Many thanks David,
This will certainly send me in the right direction. I will keep you updated with my progress.
Pete
Okay, the remote syncing is working in the html example though. Right now the first step is to getting it to write to the indexexedDB local storage which it isn't doing. I will try removing the reference to the couchdb and see if that is what is stopping it from inserting local data.
Thanks very much David, it still isn't inserting local db records but at least I have the right syntax to work with now so I will keep fighting with it.
Cheers,
Pete
Hi, I am working on a very simple application to incorporate an offline first pouchdb local db and sync it with an online couchdb db in real time. As this is my first project, I am struggling a bit with getting started on how to approach this. I have sent you an email with a sample file, if you could give me a hand in how to best approach this, I will gladly share the finished example with the community.
Cheers,
Pete
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.