Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gmail push notifications in Rails

I am developing an application where users add their Gmail accounts, and I do some classification work on their emails.

I want to be notified when a new email comes to any of the registered accounts.

A solution is to keep polling the accounts via IMAP and saving the last email date I have fetched to check whether there is a new mail or not, but this has a lot of overhead.

Any idea how to monitor Gmail and be notified when a new email is received and integrate this with a Rails app? Is there an extension which can do that and send a post request to my Rails application for example?

like image 297
Shakes Avatar asked May 23 '12 08:05

Shakes


1 Answers

I'm pretty sure IMAP is the only answer here.

You may want to see whether IDLE works--I've read conflicting answers. If it does, it's way more responsive than polling.

Otherwise, poll away.

Wikipedia article on IDLE

like image 195
David Avatar answered Oct 20 '22 18:10

David