jeebface
jeebface

Reputation: 841

Rails - creating a notification system similar to that of Facebook

I'm a newbie trying to make his very first web application. What I have in mind right now is a notification system similar to that of Facebook. I did a quick search to see what other people have talked about the subject, and saw many different opinions on how to approach the problem: some people recommend doing the process in the background using Resque/Delayed Job/Beanstalkd while others point to gems like Mailboxer.

Why is there a need to process the job in the background? Is it only for incoming messages? Also, would Delayed Job suffice for a simple notification system? I've heard beanstalkd is the fastest but has no support for Windows.

Any help/advice/answer would be greatly appreciated.

Upvotes: 0

Views: 1811

Answers (2)

Benjamin Bouchet
Benjamin Bouchet

Reputation: 13181

Have a look to this excellent video and text tutorial http://railscasts.com/episodes/406-public-activity it may point you to the right direction

Also on the same website you will find a lot of useful informations

Upvotes: 1

rorra
rorra

Reputation: 9693

You will need to run a rake task or a delayed job.

On a web application, you have to send the answer to the user right away, you don't want to make him waiting until you do all the processing of broadcasting, so you just save the publication and show him the success message.

Then, you process the notification, and you broadcast this notification to all the subscriber, this process may take a bit (imagine someone with 2,000 friends).

Finally, if you want a notification system to show the realtime notifications, the background process could broadcast the message though javascript and websockets, have a look at Best Ruby on Rails WebSocket tool

Upvotes: 1

Related Questions