Live data from Hacker News

Grocer - New Gem for Sending Apple Push Notifications in Ruby

github.com

11–20 of 20 posts

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#11
post #7

Earlier quoted context omitted.

Sweet. Now accepting pull requests :) Interesting. We haven't hit that issue yet. Hmmm. We also haven't had any issues with feedback affecting our outgoing messages. Yeah we just check for messages from the feedback socket after sending a notification (as Apple's guide recommends) but we're not doing anything fancy like waiting for a response. Sounds cool though.

I want to remove the IO.select because it slows things down unfortunately. I noticed you are using enhanced push, but also opening a feedback socket separately. I was under the impression that you were supposed to read feedback in-line with the enhanced protocol, but I may have gotten this wrong. Are you using the enhanced protocol -and- listening to the feedback socket? This is interesting, and may solve a problem I…

Couldn't find that in the guide (reading feedback from the same socket). I might have missed it though.

And yep. We're using the enhanced protocol while opening another connection to the feedback service. I just followed this section of the docs.

http://developer.apple.com/library/mac/#documentation/Networ...

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#12
post #6

Earlier quoted context omitted.

Nice! We keep a single connection open using the standalone gem. But yeah you're right it would be an issue if you were connecting to Apple's servers in a resque worker for example, since the socket would be opened in a new child for each job. I bet you could get around this though by opening a socket in the parent and using it in each child process. Reconnecting might be a little trickier though. apnmachine looks pr…

Don't know the standalone gem, I'll have to check that out. I'll be glad to get some feedback on apnmachine :)

> the standalone gem

@vanstee is referring the Grocer being a RubyGem and not needing other dependencies like Resque.

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#13
post #7

Earlier quoted context omitted.

No problem, I would love to contribute! My account is kyledrake on Github. Right now I'm experimenting with socket keepalive, which I think may be important to keeping socket connections open (per some discussion I found from an Apple dev). If my tests go well I'll send a pull request later tonight! The one thing I haven't figured out yet is how to stop messages from being dropped after feedback comes in. It has a te…

Sweet. Now accepting pull requests :) Interesting. We haven't hit that issue yet. Hmmm. We also haven't had any issues with feedback affecting our outgoing messages. Yeah we just check for messages from the feedback socket after sending a notification (as Apple's guide recommends) but we're not doing anything fancy like waiting for a response. Sounds cool though.

Where do you call the feedback socket after sending a notification in the code? Is this something you do on your application's end? Sorry, last question I promise. Pull requests coming soon!

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#15
post #7

Earlier quoted context omitted.

Sweet. Now accepting pull requests :) Interesting. We haven't hit that issue yet. Hmmm. We also haven't had any issues with feedback affecting our outgoing messages. Yeah we just check for messages from the feedback socket after sending a notification (as Apple's guide recommends) but we're not doing anything fancy like waiting for a response. Sounds cool though.

Where do you call the feedback socket after sending a notification in the code? Is this something you do on your application's end? Sorry, last question I promise. Pull requests coming soon!

Oh sorry. Yeah we do this in our app (not automatically in the gem).

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#16

Or, if you use Urban Airship; it's literally like five lines of code with HTTParty to send a push notification. Of course, your needs may vary, but UA scales well and is essentially free to start with.

Oh yeah I've heard great things about Urban Airship. Also I noticed a new heroku add-on that looks pretty nifty as well.

https://addons.heroku.com/boxcar

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#17

Or, if you use Urban Airship; it's literally like five lines of code with HTTParty to send a push notification. Of course, your needs may vary, but UA scales well and is essentially free to start with.

I was just looking at options for push notifications in ruby. I found a gem called apn_on_rails (https://github.com/PRX/apn_on_rails) which sort of worked. But I didn't know how to keep persistent connections and was afraid of accidentally spamming Apple's servers. I thought about outsource the problem to Urban Airship, but unfortunately their free service only works for 45 days then costs hundreds of dollars a month. Grocer looks really interesting and I'd definitely want to try it out.

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#18
post #17

Or, if you use Urban Airship; it's literally like five lines of code with HTTParty to send a push notification. Of course, your needs may vary, but UA scales well and is essentially free to start with.

I was just looking at options for push notifications in ruby. I found a gem called apn_on_rails ( https://github.com/PRX/apn_on_rails ) which sort of worked. But I didn't know how to keep persistent connections and was afraid of accidentally spamming Apple's servers. I thought about outsource the problem to Urban Airship, but unfortunately their free service only works for 45 days then costs hundreds of dollars a mon…

You scared me there for a minute. I thought they'd dropped their free plan. Turns out it still exists: https://go.urbanairship.com/accounts/register/

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#19

Hey, you do know that Apple requires developers to maintain persistent connections to their servers, right? Checkout https://github.com/jnak/apnmachine Feature list: - persistent connection to APN Servers (as Apple recommends) - real-time notifications (no regular polling a la Resque) - super easy to use in Ruby and any languages (as easy as enqueuing a serialized JSON hash in Redis) - persist and queue messages when…

This was exactly my thought, and having followed the link I'm not clear how (or even whether) this gem solves it.

I currently use the Python/Twisted-based https://github.com/samuraisam/pyapns in production. It looks a bit abandoned, but it has a Ruby client and has been rock-solid for me.

Re: Grocer - New Gem for Sending Apple Push Notifications in Ruby

#20
post #17

Or, if you use Urban Airship; it's literally like five lines of code with HTTParty to send a push notification. Of course, your needs may vary, but UA scales well and is essentially free to start with.

I was just looking at options for push notifications in ruby. I found a gem called apn_on_rails ( https://github.com/PRX/apn_on_rails ) which sort of worked. But I didn't know how to keep persistent connections and was afraid of accidentally spamming Apple's servers. I thought about outsource the problem to Urban Airship, but unfortunately their free service only works for 45 days then costs hundreds of dollars a mon…

There's another gem you should take a look at, too, called 'rapns'. The maintainer is pretty active with fixes and it maintains persistent connections with a daemon.
Post reply on HN