We are facing a similiar requirement:

Basically our workflow is:

1. Web application serves clients, they update data on their sessions
2. A cron job runs every 10 minutes and process ALL users who have logged 
previously on the iPad app and synces data between MySQL - Couchbase Server 
(Query Views directly from Couchbase, store data with Sync Gateway)
3. Sync Gateway does it's job and pushes data to devices.

That process makes several readings on MySQL and Couchbase Side

If we could implement "Follow", we could filter and only enqueue sync for 
channels affected in _changes feed, so not all users need to ve queried for 
changes.

But no idea how to process _changes feed from PHP side, as no idea of GO 
language.

El martes, 16 de diciembre de 2014, 15:20:26 (UTC-5), Christoph Berlin 
escribió:
>
>  Thanks :)
>
>
>  
> On Dec 16, 2014, at 12:18 PM, Traun Leyden <[email protected] 
> <javascript:>> wrote:
>
>   I just updated https://github.com/couchbaselabs/CouchChat-PhoneGap and 
> https://github.com/couchbaselabs/CouchChat-ios with that warning. 
>
>  
>  
> On Tue, Dec 16, 2014 at 12:12 PM, Christoph Berlin <
> [email protected] <javascript:>> wrote: 
>>
>>  Hi Traun,
>>
>>  I just wanted to provide a quick update. Its working! We took your 
>> notification document approach, combined it with Follow and voila. Thanks 
>> much!
>>
>>  If I may provide a little bit of feedback. I may be wrong but it seems 
>> that the CouchChat example is outdated and not the recommended approach. 
>> Maybe mark it as such – I spent a day trying to get it to work.
>>
>>  Thanks as always
>> Christoph
>>
>>   From: Traun Leyden <[email protected] <javascript:>>
>> Reply-To: "[email protected] <javascript:>" <
>> [email protected] <javascript:>>
>> Date: Saturday, December 13, 2014 at 9:54 AM 
>>
>> To: "[email protected] <javascript:>" <
>> [email protected] <javascript:>>
>> Subject: Re: Apple Push Notification Service with UILocalNotfication + 
>> Sync Gateway instead
>>   
>>    You should check out Jason Smith's library follow 
>> <https://github.com/iriscouch/follow>, which is written in Node.js.
>>
>> On Sat, Dec 13, 2014 at 9:51 AM, Christoph Berlin <
>> [email protected] <javascript:>> wrote: 
>>>
>>>  Well I am familiar with Node and the traditional languages…GO is new 
>>> for me but I accept the challenge :)
>>>
>>>   From: Traun Leyden <[email protected] <javascript:>>
>>> Reply-To: "[email protected] <javascript:>" <
>>> [email protected] <javascript:>>
>>> Date: Saturday, December 13, 2014 at 9:50 AM 
>>>
>>> To: "[email protected] <javascript:>" <
>>> [email protected] <javascript:>>
>>> Subject: Re: Apple Push Notification Service with UILocalNotfication + 
>>> Sync Gateway instead
>>>   
>>>    
>>> No problem.  
>>>
>>>  Btw, which server side language are you looking to use so that I can 
>>> try to steer future examples towards that?
>>>
>>>  
>>> On Sat, Dec 13, 2014 at 9:37 AM, Christoph Berlin <
>>> [email protected] <javascript:>> wrote: 
>>>>
>>>>  Traun,
>>>>
>>>>  Awesome! As always your input is very much appreciated. I will review 
>>>> as soon as possible and get back to you.
>>>>
>>>>  Thanks Christoph
>>>>
>>>>   From: Traun Leyden <[email protected] <javascript:>>
>>>> Reply-To: "[email protected] <javascript:>" <
>>>> [email protected] <javascript:>>
>>>> Date: Saturday, December 13, 2014 at 8:43 AM
>>>> To: "[email protected] <javascript:>" <
>>>> [email protected] <javascript:>>
>>>> Subject: Re: Apple Push Notification Service with UILocalNotfication + 
>>>> Sync Gateway instead
>>>>  
>>>>    
>>>>  Hey Christoph, 
>>>>
>>>>  I have a complete working example you can look at.  Every time I go 
>>>> to our San Francisco or Mountain View office, I get picked up by an 
>>>> Estimote beacon and get a push notification.
>>>>
>>>>  It has the following components:
>>>>
>>>>  * OfficeRadar iOS app <https://github.com/tleyden/office-radar>
>>>> * OfficeRadar App Server 
>>>> <https://github.com/tleyden/officeradar-appserver> (written in Go, 
>>>> runs in the Cloud)
>>>> * Uniqush Push Notification Gateway <http://uniqush.org/> (3rd party 
>>>> server, runs in the Cloud)
>>>>
>>>>  The logic flow is as follows:
>>>>  
>>>>  * iOS device comes in range of an Estimote beacon
>>>> * The app receives a callback from Estimote SDK 
>>>> <https://github.com/tleyden/office-radar/blob/master/ios/OfficeRadar/OfficeRadar/RDBeaconManager.m#L185-L193>
>>>> * The app saves a new GeofenceEvent document 
>>>> <https://github.com/tleyden/office-radar/blob/master/ios/OfficeRadar/OfficeRadar/RDBeaconManager.m#L152>
>>>>  
>>>> to Couchbase Lite (via a CBLModel)
>>>> * Couchbase Lite pushes this to Sync Gateway via continuous push 
>>>> replication 
>>>> <https://github.com/tleyden/office-radar/blob/master/ios/OfficeRadar/OfficeRadar/RDAppDelegate.m#L144-L167>
>>>> * Since the App Server is following the changes feed 
>>>> <https://github.com/tleyden/officeradar-appserver/blob/master/officeradar.go#L129-L174>,
>>>>  
>>>> it will see the new GeofenceEvent document
>>>> * Then it sends a notification to Uniqush via HTTP Rest API call 
>>>> <https://github.com/tleyden/officeradar-appserver/blob/master/officeradar.go#L402-L425>
>>>>
>>>>  HTH!
>>>>
>>>>  
>>>> On Fri, Dec 12, 2014 at 8:10 PM, Christoph Berlin <
>>>> [email protected] <javascript:>> wrote: 
>>>>>
>>>>> Hi, 
>>>>>
>>>>>  I apologize in advance if it looks like I try to hijack this thread 
>>>>> - that is not my intent. However can someone outline how to implement 
>>>>> push 
>>>>> notification with the sync gateway? I found the Couchbase Chat app with 
>>>>> its 
>>>>> push notification robots but I cannot get it too work at all. In this 
>>>>> project the code is outdated or at least I don't understand it all which 
>>>>> could very well be. Despite the fact that I cannot get it to work I have 
>>>>> no 
>>>>> idea what sync-wrangler does and there is no documentation at all.
>>>>>
>>>>>  We are very well aware of the push notification requirements such as 
>>>>> registering devices, etc. We have the infrastructure already in place - 
>>>>> what we miss is the ability to "listen" to the database changes and 
>>>>> trigger 
>>>>> a push when a push is needed. 
>>>>>
>>>>>  In this thread people talk about sync-wrangler, forward and other 
>>>>> tools but we would appreciate if someone could outline what needs to be 
>>>>> done or how to the make Chat push node application work...
>>>>>
>>>>>  I truly appreciate your help.
>>>>> Christoph 
>>>>>
>>>>>
>>>>> On Thursday, November 13, 2014 2:45:02 PM UTC-8, James Nocentini 
>>>>> wrote: 
>>>>>>
>>>>>>  Great thanks
>>>>>> Using Sync Gateway 1.0.3
>>>>>> I will try to go for the option described by Jens in the third 
>>>>>> comment of https://github.com/couchbase/sync_gateway/issues/379 
>>>>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcouchbase%2Fsync_gateway%2Fissues%2F379&sa=D&sntz=1&usg=AFQjCNF8tnGAO5-etCCnRBwAhFvtsyt_ww>
>>>>>> Another option would be to query the view directly to the Couchbase 
>>>>>> Server with https://github.com/couchbase/couchnode ?
>>>>>>
>>>>>> I'm still not sure in which use case to use the sync-wrangler 
>>>>>> approach with channels instead of view queries https://github.com/
>>>>>> couchbaselabs/CouchChat-iOS/blob/push/push-notifications/index.js
>>>>>>
>>>>>> On Thursday, 13 November 2014 22:02:23 UTC, Traun Leyden wrote: 
>>>>>>>
>>>>>>> You can access views via the admin API now, see: 
>>>>>>>
>>>>>>>  https://github.com/couchbase/sync_gateway/issues/379
>>>>>>>  
>>>>>>>  The non-admin API is coming soon:
>>>>>>>
>>>>>>>  https://github.com/couchbase/sync_gateway/issues/449
>>>>>>>  
>>>>>>>  Which version of Sync Gateway are you running?
>>>>>>>
>>>>>>>  
>>>>>>> On Thu, Nov 13, 2014 at 1:57 PM, James Nocentini <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> I'm trying to set up Apple Push Notifications when some user 
>>>>>>>> actions are triggered on the app. Here's what I have managed to do so 
>>>>>>>> far:
>>>>>>>> - User logs in and accepts to receive push notifications 
>>>>>>>> - New Profile document is saved with device_token as one property
>>>>>>>> - Then when a push notification is needed, create a Notification 
>>>>>>>> document and save it.
>>>>>>>>
>>>>>>>>  Using follow <https://github.com/iriscouch/follow> to get 
>>>>>>>> notified of changes and check if the type of the document is 
>>>>>>>> "notification". From there I need the list of device tokens but I'm 
>>>>>>>> struggling to get them.
>>>>>>>> Tried using cradle <https://github.com/flatiron/cradle> but I 
>>>>>>>> can't get save/query views to work. It seems like the sync gateway 
>>>>>>>> REST 
>>>>>>>> interface doesn't support views?
>>>>>>>>
>>>>>>>>   follow(configuration, function(error, change) {
>>>>>>>>    if (!error) {
>>>>>>>>      console.log('got change number ' + change.seq + ': ' + 
>>>>>>>> change.id);
>>>>>>>>  
>>>>>>>>      if (change.doc.type == "notification") {
>>>>>>>>        
>>>>>>>>        // missing: query a view on the sync gateway
>>>>>>>>        // to retrieve all the device tokens
>>>>>>>>        // to send the notification to
>>>>>>>>        
>>>>>>>>      }
>>>>>>>>    }
>>>>>>>>  });
>>>>>>>>  
>>>>>>>>  Looking at the push notification robot 
>>>>>>>> <https://github.com/couchbaselabs/CouchChat-iOS/blob/push/push-notifications/index.js>
>>>>>>>>  to 
>>>>>>>> fetch those device tokens via a channel but I couldn't find the 
>>>>>>>> sync-wrangler node module.
>>>>>>>> What's the best way to retrieve device tokens in this case?
>>>>>>>>
>>>>>>>>  Thanks
>>>>>>>>  
>>>>>>>>  On Monday, 9 June 2014 16:48:20 UTC+1, Jens Alfke wrote: 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  On Jun 9, 2014, at 8:26 AM, CouchbaseLover <[email protected]> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>  Ok let's say we expand the way "CouchChat" works and implement 
>>>>>>>>> Apple's Notifications but without the use of talking to the APNS 
>>>>>>>>> server. 
>>>>>>>>> Instead we check the gateway’s _changes feed and use that instead 
>>>>>>>>> to make a "UILocalNotfication" instead of a "Push Notification" that 
>>>>>>>>> needs 
>>>>>>>>> to talk to the APNS server.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  Oh, I see. This will only work while your app is active/visible. 
>>>>>>>>> The main advantage of push notifications is that they can be 
>>>>>>>>> delivered even 
>>>>>>>>> when your app isn’t running. Push notifications also don’t require 
>>>>>>>>> keeping 
>>>>>>>>> an open socket to the server, so they’re a lot better for battery 
>>>>>>>>> life. 
>>>>>>>>> (They’re triggered from a sideband message over regular GSM, kind of 
>>>>>>>>> like 
>>>>>>>>> an invisible SMS message, so they don’t require keeping the faster 
>>>>>>>>> and more 
>>>>>>>>> power-hungry 3G/LTE/4G/WiFi radios active.)
>>>>>>>>>
>>>>>>>>> —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 [email protected].
>>>>>>>> To view this discussion on the web visit 
>>>>>>>> https://groups.google.com/d/msgid/mobile-couchbase/
>>>>>>>> 3f089edf-73a9-4efc-ab33-67f224e45c6d%40googlegroups.com 
>>>>>>>> <https://groups.google.com/d/msgid/mobile-couchbase/3f089edf-73a9-4efc-ab33-67f224e45c6d%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>>>>>>  
>>>>>>>>
>>>>>>>>
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>  
>>>>>>>  
>>>>>>>       -- 
>>>>> 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 [email protected] <javascript:>.
>>>>>  To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/mobile-couchbase/41406555-f4fa-4a7c-a361-fefa2100b863%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/mobile-couchbase/41406555-f4fa-4a7c-a361-fefa2100b863%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>>>  
>>>>>
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>  
>>>>   -- 
>>>>  You received this message because you are subscribed to a topic in 
>>>> the Google Groups "Couchbase Mobile" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/mobile-couchbase/EBuekY1Vizs/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> [email protected] <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCGc3sTCQBoUtkzCgY6NkdnKWJHJrFVbDuW0n9e1xJCArQ%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCGc3sTCQBoUtkzCgY6NkdnKWJHJrFVbDuW0n9e1xJCArQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>   
>>>> -- 
>>>> 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 [email protected] <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/mobile-couchbase/D0B1B930.1BA2C%25cberlin%40christophberlin.com
>>>>  
>>>> <https://groups.google.com/d/msgid/mobile-couchbase/D0B1B930.1BA2C%25cberlin%40christophberlin.com?utm_medium=email&utm_source=footer>.
>>>>  
>>>>
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>  
>>>   -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "Couchbase Mobile" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/mobile-couchbase/EBuekY1Vizs/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected] <javascript:>.
>>>  To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCEE8mZ0TAdM2hG4pQnNHG7yaAA6ZM4ySeypdHuri0LarQ%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCEE8mZ0TAdM2hG4pQnNHG7yaAA6ZM4ySeypdHuri0LarQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>   
>>> -- 
>>> 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 [email protected] <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/mobile-couchbase/D0B1BC92.1BA51%25cberlin%40christophberlin.com
>>>  
>>> <https://groups.google.com/d/msgid/mobile-couchbase/D0B1BC92.1BA51%25cberlin%40christophberlin.com?utm_medium=email&utm_source=footer>.
>>>  
>>>
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>  
>>   -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Couchbase Mobile" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/mobile-couchbase/EBuekY1Vizs/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>>  To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCEGH-F4YcE3bEPQoGqHd1craLQsT09vcFSQU91BpjNFMw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCEGH-F4YcE3bEPQoGqHd1craLQsT09vcFSQU91BpjNFMw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>   
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/mobile-couchbase/D0B5D18B.1C20A%25cberlin%40christophberlin.com
>>  
>> <https://groups.google.com/d/msgid/mobile-couchbase/D0B5D18B.1C20A%25cberlin%40christophberlin.com?utm_medium=email&utm_source=footer>.
>>  
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>  
>   -- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "Couchbase Mobile" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/mobile-couchbase/EBuekY1Vizs/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCH-jpS%2B1C-iNjz6Gk6NjKXhG_y5WVvVqtDCAD%2BnywyqeA%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCH-jpS%2B1C-iNjz6Gk6NjKXhG_y5WVvVqtDCAD%2BnywyqeA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>  
> 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/39f528d8-8c18-4b93-8ded-3ff44310b035%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to