[push/pull setCookieNamed:@"SyncGatewaySession" withValue:sessionValue path:nil expirationDate:nil secure:NO];
- (void)defineSync
{
pull = [_database createPullReplication:_remoteURL];
push = [_database createPushReplication:_remoteURL];
pull.continuous = push.continuous = YES;
[self listenForReplicationEvents:push];
[self listenForReplicationEvents:pull];
}
- (void)startSync {
[pull start];
[push start];
}
On Sep 29, 2014, at 5:25 AM, Thiago Alencar <thia...@gmail.com> wrote:This document is newer, so I believe sync gateway will make this the winning revision from the conflict
After logging in, I first wait for the replication to complete, and just then I call [database existingDocumentWithID], in the hope that now I'll get the document instead of creating a new one.But no, I'm still not able to find the document and therefore I have no access to the "blobData" generated from the first device.
And already to advance / confirm: right now I have basically nothing in my sync function
function(doc) {
channel(doc.channels);
if(doc.type == "contactInfo"){
channel("public");
access(doc.username, "public");
} }+ (NSString*) type{ return @"contacInfo"; }There are many ways to solve this, depending on your apps' goals. A simple one is:
- Define a private channel for each user, named something like "user-" + username
- When creating a user account, add that channel to their admin_channels property
- When creating documents, add a "channels" property whose value is an array containing the user's channel
On Sep 30, 2014, at 3:10 AM, Thiago Alencar <thia...@gmail.com> wrote:Regarding the approach suggested of assigning each user to a private channel: does that scale well ? By well I mean, at the degree that a couchbase server scales?
function (doc) {
channel(doc.channels);
}
function (doc) {
channel("*");
var this_user = "Is there a way to get the username of this request context?"
access(this_user, "*");
}
On Oct 1, 2014, at 3:08 AM, Thiago Alencar <thia...@gmail.com> wrote:This is needed because of a limitation in the implementation that we plan to fix, so maybe by the time you read this it's no longer necessary.)"
By the way, I've tried with the wildcard channel access(doc.username, "*") but it didn't work in my tests: the document didn't make it to the "other side".