Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggering APN on New Message #46

Closed
michaelperalta opened this issue Mar 13, 2013 · 7 comments
Closed

Triggering APN on New Message #46

michaelperalta opened this issue Mar 13, 2013 · 7 comments
Labels

Comments

@michaelperalta
Copy link

I'm curious, and I just may not be seeing it in the explanation, of where I would put the trigger to send the APN when a new Message is received. Just as a brief explanation, I want to send a push notification to a user when he receives a new message. Can anyone provide me with some assistance on how to make this work?

@vanstee
Copy link
Member

vanstee commented Mar 13, 2013

I'm going to guess that you're talking about using this with a webapp (probably Rails). Queuing a background job with https://github.com/mperham/sidekiq or http://github.com/defunkt/resque to send the notification would probably be the best idea. Grocer, doesn't have any specific Railsyness that plugs right in, but it should be pretty easy to just queue up the notification job in some kind of after_commit hook or something.

It would probably be cool if we had a blog post about Grocer + Rails to like to.

Did that answer your question?

@michaelperalta
Copy link
Author

Yeah @vanstee that helps, I'll take a look at the two things you sent me. I'm surprised I haven't seen a more concise Grocer + Rails blog post like you've suggested. Feel like it could be very valuable for those trying to implement this sort of functionality. Thanks for the help!

@vanstee
Copy link
Member

vanstee commented Mar 14, 2013

@michaelperalta One side note. If you go the background job route, you'll probably want to make sure you open the connection in the parent process/thread. Apple specifically mentions not to open and close connections for each message. They identify it as a denial of service I think.

@vanstee vanstee closed this as completed Mar 14, 2013
@linjunpop
Copy link

@vanstee I'm using Grocer on a Rails application with Sidekiq. Would you mind write a Wiki/Blog about the correct way to integrate Grocer with Sidekiq? Thanks. 😺

@vanstee
Copy link
Member

vanstee commented Mar 15, 2013

@linjunpop Totally. I'll try to find some time over the next few weeks.

@michaelperalta
Copy link
Author

Sounds great, definitely looking to implement this in my app soon so it would be very helpful. I appreciate it.

@linjunpop
Copy link

@vanstee Do you wanna have a look at this? https://gist.github.com/linjunpop/5202365, Thanks 😺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants