Ability to send to multiple deviceTokens?

417 views
Skip to first unread message

vanc...@gmail.com

unread,
Jun 21, 2017, 2:05:40 PM6/21/17
to pushy
I'm using notnoop, but want to make the jump to pushy and HTTP/2.  In notnoop, I can send a single notifications to multiple deviceTokens (multiple devices).  I noticed that the pushy builder only has a String for token, and not a List.  I can wrap the list contents in a for loop and emit individual notifications, but I'm wondering if there isn't just a single call to make with all the device tokens (a la notnoop)?  Thanks for your responses, I'm an iOS/Objective C programmer wandering into the Java world.


Jon Chambers

unread,
Jun 21, 2017, 2:16:34 PM6/21/17
to vanc...@gmail.com, pushy
First and foremost, welcome aboard!

We don't provide an affordance for "bulk send" operations; just using a `for` loop is the right thing to do.

One of the benefits of using the HTTP/2-based APNs API is that we can track the status of each individual `sendNotification` operation, and so we return a `Future` (roughly equivalent to an `NSOperation` in the Objective-C world) for each operation. If we provided a `sendNotification` method that accepted a collection of device tokens, it's not clear what we'd return. As one option, we could return a list of futures, but then it would be difficult to correlate Futures with individual destination tokens. Another option would be to return a single Future that represents the status of all sent notifications, but that seems even more harrowing. In the end, we concluded that it makes the most sense to let callers deal with success/failure of individual notifications on their own since use cases may vary widely.

Hope that helps!

-Jon

On Wed, Jun 21, 2017 at 2:05 PM, <vanc...@gmail.com> wrote:
I'm using notnoop, but want to make the jump to pushy and HTTP/2.  In notnoop, I can send a single notifications to multiple deviceTokens (multiple devices).  I noticed that the pushy builder only has a String for token, and not a List.  I can wrap the list contents in a for loop and emit individual notifications, but I'm wondering if there isn't just a single call to make with all the device tokens (a la notnoop)?  Thanks for your responses, I'm an iOS/Objective C programmer wandering into the Java world.


--
Pushy is an open-source Java library for sending APNs (iOS and OS X) push notifications. Pushy is brought to you by the engineers at RelayRides.
---
You received this message because you are subscribed to the Google Groups "pushy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pushy-apns+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vanc...@gmail.com

unread,
Jun 21, 2017, 2:26:23 PM6/21/17
to pushy, vanc...@gmail.com
Thanks for the response, Jon, it was very helpful.
To unsubscribe from this group and stop receiving emails from it, send an email to pushy-apns+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages