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] > <javascript:>> 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. For more options, visit https://groups.google.com/d/optout.
