Can't Pull from the server

I have issue pulling the content of documents from server to an iphone( I can push to server through the Sync Gateway server). But If I run syncgateway in my mac, I am able to pull the content to simulator as well push to the server. Did anyone face similar issue?

Hey, could you give us some more information? For example, what error do you get? Also, are you able to share your sync function with us?

To test, I took the example code grocerySync. I ran with the the way it is on my iPhone. It did run without any issue. I change to to our sync gateway server, but it is not pulling data. It is able to push to backend server. I can see those documents. Lastly, when I run the sync gateway server locally on my mac, It is able to push and pull the documents and its content to simulator. Below is the log when I run in my iPhone. It looks to pull, but nothing happens.

2015-06-08 13:34:49.765 GrocerySync[1359:284846] SYNC idle
2015-06-08 13:34:49.766 GrocerySync[1359:284846] SYNC idle
2015-06-08 13:34:49.766 GrocerySync[1359:284846] Application windows are expected to have a root view controller at the end of application launch
2015-06-08 13:34:49.911 GrocerySync[1359:284846] SYNC progress: 0 / 0
2015-06-08 13:34:49.915 GrocerySync[1359:284846] SYNC progress: 0 / 0
2015-06-08 13:34:49.964 GrocerySync[1359:284846] SYNC progress: 0 / 0

Usually that kind of problem means that your user account doesn’t have permission to access the channel the documents are being added to on SG.

When you set up your SG did you use the config file that comes with Grocery Sync?

#define kServerDbURL @“

Is that not your sync gateway server? I saw it pulling. It has more 1million documents, you need to wait until it reads all the documents before it display on the device.

Yes, but you said when you switch to your Sync Gateway it doesn’t work. How did you configure your Sync Gateway?

Sync gateway server was not configured by me. I just change to the path provided by our team member(he is not here for a week or so) who set up the sync gateway server. Is there a link to set up sync gateway server?

To run locally: I use
#define kServerDbURL @“http://localhost:4984/mobile-app” and use config file and direct to the database server. It works fine when I run on my simulator.

It has more 1million documents, you need to wait until it reads all the documents before it display on the device.

I just made the following changes:

I re-tested GrocerySync-Android and everything looks good.

There is no problem with the example or sync gateway server(at couchbase) and backend in the example. I have problem with my sync gateway server which is set up at my company.

By the way, the example works fine with couchbase provided sync gateway server i.e.

Trying to understand why it is only pushing to backend, but not pulling from backend when I run through a device. It has no problem when run through the simulator.

Local sync gateway works fine.

The most likely issue is that the Sync Gateway set up by your team member is using a config file that’s not granting access to the ‘*’ channel for the GUEST user - that would explain why you can write but not read.

I ran the same config.json locally, it works perfectly on simulator with guest and a particular userID. My Android friend is able to push and pull on his android device. I just can’t pull from database server when I ran the app in my iOS device(iPhones) though pushing works fine. By the way, the sync gateway server version is Sync Gateway/1.0.4(34;04138fd) in both the cases.

Turn on the iOS ‘Sync’ and ‘RemoteRequest’ logging keywords and see if there are any clues in the logs. You can upload it to gist/pastebin/etc and post a link here.

I will post that in few minutes. Mean while, I have another question related to this: The remote sync gateway is behind a load balancer. Will that create any problem to pull from backend db server?

The only problems we’ve seen with load balancers (or other types of proxies) is when they either don’t work correctly with WebSocket connections, or are too aggressive about timing out idle sockets.

Talking about WebSocket connections: How does it works for Android? Does iOS only uses WebSocket connection, not Android?

It was load balancers. Once we enable web socket connection, it worked fine for us.