Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I wanted to implement real time push notification to one of the apps written in RoR. I don't have any experience with nodejs, nowjs, express or socketio.

What would be the easiest way to implement the realtime push notification system?

share|improve this question

5 Answers 5

The easiest way would be to use a long-poll. However, this is not push. A long-poll is a normal request, with some long timeout. If there is a message, the request will be answered. Your client receives the answer and starts the next request. This way you almost always have an open request, waiting for an answer.

share|improve this answer

http://railscasts.com/episodes/260-messaging-with-faye

Taken from this question: http://stackoverflow.com/questions/5616614/how-would-you-create-a-notification-system-like-on-so-or-facebook-in-ror

My personal opinion is that while architecturally one of the most widespread solution is long-poll or comet, from a development perspective, I don't agree that it's the easiest in the sense that it's a part of the way to do things: simply there's much more in a queue/pubsub system because of the load its backend has to bear.

Personally, I'd even consider plugging in an ActiveMQ server or some other message queue solution, as long as it has a notion of per-user queue, which can be drained by a client, and it has a JS API to drain, and perhaps a Ruby / REST API to push, it works.

But again, this is my personal opinion, that while yes, long-polling can be an option (or socket.IO can be), it's only a part of the equation, even if a major part.

share|improve this answer

Take a look at Bridge made by the creators of nowjs. It helps you push messages down to your clients very easily, whether you're building a Rails app or a Node.js app or even python apps. It supports a lot of languages and platforms. It's a very robust system that can handle billions of messages a day.

share|improve this answer

The good folks at pubsubhubbub have a great solution using RSS feeds. 'PubSubHubBub' is a new protocol for real-time notifications.

In short, how you can enable your app to push real-time notifications:

  • Enable your app with an RSS feed
  • You need to register your feed with a Pubsubhubbub hub
  • Your subscribers will then receive real-time (or extremely close to real-time) updates from the hub

Please refer to this youtube video for a comprehensive presentation on the subject.

share|improve this answer

I've seen a port of Socket.IO on github (link). I guess you can use it.

Socket.IO is the easiest way to do a realtime push app, for that it abstracts you from the transport mechanism being used for the push.(for more information see the link).

The Advantages of using Socket.IO is that you don't need to be bothered about the underlying transport being used. The documentation is very simple to follow and yet, is very detailed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.