0

In Xamarin, I am trying to sync the local database with sync gateway, but it is not syncing. I am trying it with sample https://github.com/couchbaselabs/mini-hacks/tree/master/kitchen-sync

Local database is getting updated but it is not syncing with sync gateway

I have provided the sync url:http://localhost:4984/sync_gateway/ Also updated config file

{
    "interface": ":4984",
    "adminInterface": ":4985",
    "log":["CRUD+", "REST+", "Changes+", "Attach+"],
    "databases": {
        "sync_gateway": {
        "server": "walrus:data",
        "bucket": "sync_gateway",
         "sync": `function(doc)
         {
             channel(doc.channels);
         }`,
         "users": {
             "GUEST": {
             "disabled": true,
             "admin_channels": [ "*" ]
         }
    }
}

On checking the data bucket, item count is not getting added up. Can anyone help me out.

borrrden
  • 33,256
  • 8
  • 74
  • 109
  • Did you add any users to sync gateway? GUEST is disabled so if not nobody will have the proper access. Also, the first thing to always do is check your logs on both Android and Sync Gateway (it might very well tell you the problem) – borrrden Jan 09 '17 at 22:50
  • I have also tried by enabling guest.Log is not updated in sync gateway. It just shows the bucket i created Bucket "sync_gateway" loaded on node 'ns_1@127.0.0.1' in 0 seconds. – Renjith Prasannan Jan 10 '17 at 05:43
  • @borrrden I have also tried by enabling guest.Log is not updated in sync gateway. It just shows the bucket i created Bucket "sync_gateway" loaded on node 'ns_1@127.0.0.1' in 0 seconds. Since i am new to couchbase i am not able to find what is the issue. What i did so far is : 1. Installed the required couchbase sdk, sync gateway 2. replaced the config file with above(also tried enabling guest mode), 3. created bucket in sync gateway with name "sync_gateway" 4. changed the sync url in project with "http://localhost:4984/sync_gateway data is saved locally, but it is not showing in sync gateway – Renjith Prasannan Jan 10 '17 at 05:50
  • Did you follow all the tutorial instructions there? Can you interact with sync gateway in the browser? I think you are interacting with Couchbase Server. Sync gateway is a separate process entirely in the command prompt. – borrrden Jan 10 '17 at 12:11
  • Also, this is more relevant, you shouldn't be using `localhost` but the IP address of the machine that sync gateway is running on. Even if you are using the emulator, the emulator has its own localhost. – borrrden Jan 10 '17 at 12:13
  • @borrrden ... i have followed the instruction. But there is no proper document for xamarin couchbase integration. I don't know what is did is correct. Please find the images for the server i am using http://imgur.com/a/p4TGd – Renjith Prasannan Jan 10 '17 at 13:18
  • Well first off, your sync gateway is not connected to Couchbase Server but that won't be this problem. Change the IP address from localhost to the IP address of the machine running sync gateway as I said above, that will fix things. – borrrden Jan 11 '17 at 01:38
  • @borrrden I tried replacing localhost with IP address of my machine.Issue still persists. I have done same as mentioned in https://developer.couchbase.com/documentation/mobile/1.2/develop/training/build-first-xamarin-android-app/add-sync-gateway.xml/index.html – Renjith Prasannan Jan 11 '17 at 05:41
  • Did you get this working? From the images you posted it looks like Sync Gateway is running and configured for localhost, so you actually should connect via localhost. You can test Sync Gateway on the command line using curl to access the REST api. Try curl -X GET --header 'Accept: application/json' 'http://localhost:4984/' – Hod Jan 21 '17 at 07:54
  • yes it worked.... – Renjith Prasannan Jan 24 '17 at 09:05

0 Answers0