Re: Efficient Push/pull - Best Practices?

2014-03-19 Thread Traun Leyden
On Tue, Mar 18, 2014 at 11:04 AM, Jens Alfke  wrote:

>
> I know that the Couchbase Lite on Android doesn't yet have support for
> going on/offline, so you'll need to restart the replication as a
> workaround. (Or so I believe; Traun is the expert.)
>
>
Good news!  This was recently added to Couchbase Lite Android as part of
the Network Aware
Syncticket.

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCHDOnCZypL6AvpKje%2BkS4FN7eO%2BVYGdnic35k9ehr4qxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
It doesn't work. When I hit the square "home" button on my iPhone to put 
the app in the background, then hit the app icon to bring it to the 
foreground replication has stopped working.

I don't know how to pass command line args to phonegap. Let me ask the 
group.

slim

On Tuesday, March 18, 2014 8:06:27 PM UTC-4, Jens Alfke wrote:
>
>
> On Mar 18, 2014, at 4:45 PM, Seung Chan Lim > 
> wrote:
>
> When you say on/offline you mean if the network goes on/offline? I was 
> referring to the application going foreground/background.
>
>
> Oh, OK. That's supported too. The replicator will stop when the app goes 
> into the background and resume when it returns to the foreground. Not sure 
> why this wouldn't be working for you.
>
> Does PhoneGap allow you to add command-line args when launching your app? 
> If so, add args "-Log YES -LogSync YES". Then you'll get logging about 
> what's going on during sync. You should see messages about "Reachability 
> state", including "suspended=1" on background and "suspended=0" when 
> foregrounded.
>
> —Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/360def0d-809e-42e9-816b-6107b8b997cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Jens Alfke

On Mar 18, 2014, at 4:45 PM, Seung Chan Lim  wrote:

> When you say on/offline you mean if the network goes on/offline? I was 
> referring to the application going foreground/background.

Oh, OK. That's supported too. The replicator will stop when the app goes into 
the background and resume when it returns to the foreground. Not sure why this 
wouldn't be working for you.

Does PhoneGap allow you to add command-line args when launching your app? If 
so, add args "-Log YES -LogSync YES". Then you'll get logging about what's 
going on during sync. You should see messages about "Reachability state", 
including "suspended=1" on background and "suspended=0" when foregrounded.

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/9FEACA03-BC2A-49DA-9D0F-41D5ADB28A03%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
On iOS using phonegap.

When you say on/offline you mean if the network goes on/offline? I was 
referring to the application going foreground/background.

slim

On Tuesday, March 18, 2014 2:04:31 PM UTC-4, Jens Alfke wrote:
>
>
> On Mar 18, 2014, at 10:42 AM, Seung Chan Lim > 
> wrote:
>
> Ah... I figured it out. It seems to have to do with the fact that 
> replication stops when the app goes into PAUSE event and doesn't restart 
> when it goes into RESUME event.
>
>
> Are you talking about Android specifically? (Please be specific about 
> platforms when you ask questions.)
>
> I know that the Couchbase Lite on Android doesn’t yet have support for 
> going on/offline, so you’ll need to restart the replication as a 
> workaround. (Or so I believe; Traun is the expert.)
>
> —Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/93f5cb4b-b0a8-47a9-8b92-8638b460c20d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Jens Alfke

On Mar 18, 2014, at 10:42 AM, Seung Chan Lim  wrote:

> Ah... I figured it out. It seems to have to do with the fact that replication 
> stops when the app goes into PAUSE event and doesn't restart when it goes 
> into RESUME event.

Are you talking about Android specifically? (Please be specific about platforms 
when you ask questions.)

I know that the Couchbase Lite on Android doesn't yet have support for going 
on/offline, so you'll need to restart the replication as a workaround. (Or so I 
believe; Traun is the expert.)

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/2351EBCF-479F-49E1-B2F7-F66394CF2ED2%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
Ah... I figured it out. It seems to have to do with the fact that 
replication stops when the app goes into PAUSE event and doesn't restart 
when it goes into RESUME event.

I added an event handler to do a new POST request to _replicate when the 
RESUME event fires.

Thanks again!

slim


On Tuesday, March 18, 2014 1:14:32 PM UTC-4, Seung Chan Lim wrote:
>
> So I just ran the same code on my iPad mini and it worked.
>
> It didn't work when I was running it on my emulator.
>
> Is this odd or is it expected?
>
> slim
>
> On Tuesday, March 18, 2014 1:01:59 PM UTC-4, Seung Chan Lim wrote:
>>
>> I see.
>>
>> So both push and pull sync are started as "continuous," but I'm not 
>> seeing any sync happening.
>>
>> I update the document on my couchbaselite db with new content using "PUT" 
>>
>> I'm awaiting for it to magically make its way to couchbasecloud.com 
>>
>> But I'm not seeing any changes happen when I see it directly on 
>> couchbasecloud.com
>>
>> http://sync.couchbasecloud.com/guestconvo/2474AB4342BC425EB95D7C7679BA6C5E
>>
>> My couchbaselite is on rev 224 and the copy on couchbasecloud.com is on 
>> 221
>>
>> Am I missing something else?
>>
>> Thanks again for all your help,
>>
>> slim
>>
>> On Tuesday, March 18, 2014 12:46:42 PM UTC-4, Jens Alfke wrote:
>>>
>>>
>>> On Mar 18, 2014, at 9:38 AM, Seung Chan Lim  wrote:
>>>
>>> So I just tried continuous:true and I get back a 200 status but the body 
>>> is missing ok:true
>>> What does that mean?
>>>
>>>
>>> A minor but harmless incompatibility with CouchDB, I suppose.
>>>
>>> —Jens
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/fea8dcfc-f705-426b-8ebd-7026ca790786%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
So I just ran the same code on my iPad mini and it worked.

It didn't work when I was running it on my emulator.

Is this odd or is it expected?

slim

On Tuesday, March 18, 2014 1:01:59 PM UTC-4, Seung Chan Lim wrote:
>
> I see.
>
> So both push and pull sync are started as "continuous," but I'm not seeing 
> any sync happening.
>
> I update the document on my couchbaselite db with new content using "PUT" 
>
> I'm awaiting for it to magically make its way to couchbasecloud.com 
>
> But I'm not seeing any changes happen when I see it directly on 
> couchbasecloud.com
>
> http://sync.couchbasecloud.com/guestconvo/2474AB4342BC425EB95D7C7679BA6C5E
>
> My couchbaselite is on rev 224 and the copy on couchbasecloud.com is on 
> 221
>
> Am I missing something else?
>
> Thanks again for all your help,
>
> slim
>
> On Tuesday, March 18, 2014 12:46:42 PM UTC-4, Jens Alfke wrote:
>>
>>
>> On Mar 18, 2014, at 9:38 AM, Seung Chan Lim  wrote:
>>
>> So I just tried continuous:true and I get back a 200 status but the body 
>> is missing ok:true
>> What does that mean?
>>
>>
>> A minor but harmless incompatibility with CouchDB, I suppose.
>>
>> —Jens
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/7c9a1383-3091-48e1-8a70-fc135190ef56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
I see.

So both push and pull sync are started as "continuous," but I'm not seeing 
any sync happening.

I update the document on my couchbaselite db with new content using "PUT" 

I'm awaiting for it to magically make its way to couchbasecloud.com 

But I'm not seeing any changes happen when I see it directly on 
couchbasecloud.com

http://sync.couchbasecloud.com/guestconvo/2474AB4342BC425EB95D7C7679BA6C5E

My couchbaselite is on rev 224 and the copy on couchbasecloud.com is on 221

Am I missing something else?

Thanks again for all your help,

slim

On Tuesday, March 18, 2014 12:46:42 PM UTC-4, Jens Alfke wrote:
>
>
> On Mar 18, 2014, at 9:38 AM, Seung Chan Lim > 
> wrote:
>
> So I just tried continuous:true and I get back a 200 status but the body 
> is missing ok:true
> What does that mean?
>
>
> A minor but harmless incompatibility with CouchDB, I suppose.
>
> —Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/7ee78702-a4de-4de9-aacd-c7c8a3309e23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Jens Alfke

On Mar 18, 2014, at 9:38 AM, Seung Chan Lim  wrote:

> So I just tried continuous:true and I get back a 200 status but the body is 
> missing ok:true
> What does that mean?

A minor but harmless incompatibility with CouchDB, I suppose.

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/DC0CE75D-D1B1-4E8E-995E-0E401CBAB513%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
So I just tried continuous:true and I get back a 200 status but the body is 
missing ok:true

What does that mean?

slim

On Tuesday, March 18, 2014 12:18:22 PM UTC-4, Jens Alfke wrote:
>
>
> On Mar 18, 2014, at 8:30 AM, Seung Chan Lim > 
> wrote:
>
> When you say "start a continuous push replication," do you mean simply 
> make a single HTTP REST call to _replicate on my couchbase lite with source 
> being the couchbasecloud.com sync gateway and target being my couchbase 
> lite ? The rest is magic? Maybe I don't understand what you mean by 
> "continous push replication." Can you help me better understand?
>
>
> The Concepts 
> Guide 
> explains 
> continuous replication.
>
> Looks like our REST doc for 
> _replicate 
> is 
> missing the ‘continuous’ property. Try the CouchDB 
> docs 
> instead. 
> (Overview here
> .)
>
> —Jens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/2509cf18-4945-48f6-b95f-21e18b3cceb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Jens Alfke

On Mar 18, 2014, at 8:30 AM, Seung Chan Lim  wrote:

> When you say "start a continuous push replication," do you mean simply make a 
> single HTTP REST call to _replicate on my couchbase lite with source being 
> the couchbasecloud.com sync gateway and target being my couchbase lite ? The 
> rest is magic? Maybe I don't understand what you mean by "continous push 
> replication." Can you help me better understand?

The Concepts Guide explains continuous replication.

Looks like our REST doc for _replicate is missing the 'continuous' property. 
Try the CouchDB docs instead. (Overview here.)

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/33DCFC91-02C7-4E06-A7A6-E8233E521D02%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
The only "continuous" feature I see is as a query parameter for the 
_changes REST call. Is something similar available for the _replicate REST 
call?

slim


On Tuesday, March 18, 2014 11:30:08 AM UTC-4, Seung Chan Lim wrote:
>
> Wait... so there's something I'm missing
>
> When you say "start a continuous push replication," do you mean simply 
> make a single HTTP REST call to _replicate on my couchbase lite with source 
> being the couchbasecloud.com sync gateway and target being my couchbase 
> lite ? The rest is magic? Maybe I don't understand what you mean by 
> "continous push replication." Can you help me better understand?
>
>
>
> slim
>
> On Tuesday, March 18, 2014 11:25:41 AM UTC-4, Jens Alfke wrote:
>>
>>
>> On Mar 18, 2014, at 8:05 AM, Seung Chan Lim  wrote:
>>
>> The PUSH seems easy enough, whenever I have new data I push by making a 
>> REST call to _replicate on my couchbase lite.
>>
>>
>> Don’t do that. You should start a continuous push replication when the 
>> app starts up. The replication will then take care of watching for database 
>> changes and pushing them. (And it will intelligently do this when the 
>> device is online, and stop when offline.)
>>
>> As for the PULL, the simplest thing I can do is just have a 
>> window.setTimeout that calls _replicate on my couchbase lite (with the 
>> source and target reversed from PUSH), but I'd like to _only_ PULL from the 
>> sync gateway the moment it notifies it has something for me?
>>
>>
>> Again, you should simply start a continuous pull replication when the app 
>> starts, and it will take care of watching for changes remotely and pulling 
>> them.
>>
>> —Jens
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/c673054f-6c18-46ae-9dc1-a04a4e3e5c0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Seung Chan Lim
Wait... so there's something I'm missing

When you say "start a continuous push replication," do you mean simply make 
a single HTTP REST call to _replicate on my couchbase lite with source 
being the couchbasecloud.com sync gateway and target being my couchbase 
lite ? The rest is magic? Maybe I don't understand what you mean by 
"continous push replication." Can you help me better understand?



slim

On Tuesday, March 18, 2014 11:25:41 AM UTC-4, Jens Alfke wrote:
>
>
> On Mar 18, 2014, at 8:05 AM, Seung Chan Lim > 
> wrote:
>
> The PUSH seems easy enough, whenever I have new data I push by making a 
> REST call to _replicate on my couchbase lite.
>
>
> Don’t do that. You should start a continuous push replication when the app 
> starts up. The replication will then take care of watching for database 
> changes and pushing them. (And it will intelligently do this when the 
> device is online, and stop when offline.)
>
> As for the PULL, the simplest thing I can do is just have a 
> window.setTimeout that calls _replicate on my couchbase lite (with the 
> source and target reversed from PUSH), but I'd like to _only_ PULL from the 
> sync gateway the moment it notifies it has something for me?
>
>
> Again, you should simply start a continuous pull replication when the app 
> starts, and it will take care of watching for changes remotely and pulling 
> them.
>
> —Jens
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/f5a9915d-de24-443d-8f8d-bbb4533e6d6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient Push/pull - Best Practices?

2014-03-18 Thread Jens Alfke

On Mar 18, 2014, at 8:05 AM, Seung Chan Lim  wrote:

> The PUSH seems easy enough, whenever I have new data I push by making a REST 
> call to _replicate on my couchbase lite.

Don't do that. You should start a continuous push replication when the app 
starts up. The replication will then take care of watching for database changes 
and pushing them. (And it will intelligently do this when the device is online, 
and stop when offline.)

> As for the PULL, the simplest thing I can do is just have a window.setTimeout 
> that calls _replicate on my couchbase lite (with the source and target 
> reversed from PUSH), but I'd like to _only_ PULL from the sync gateway the 
> moment it notifies it has something for me?

Again, you should simply start a continuous pull replication when the app 
starts, and it will take care of watching for changes remotely and pulling them.

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mobile-couchbase+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/22A41AF8-8FFB-4647-A3F4-676C319F8361%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.