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?
0
http://railscasts.com/episodes/260-messaging-with-faye
Taken from this question: https://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.
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.
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.
0
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.
0
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.
Have a look at PushRadar – it delivers notifications to clients instantly, and allows you to scale to hundreds of thousands of concurrent connections. There is a pre-built Ruby library that you can use. Also, specific to this service is the fact that you can target end-users by actions they have taken on your website or web app, geographical location (countries & continents), IP address, web browser and user ID.
An example:
radar.target_country('US').target_not_action('live-chat').broadcast('test-channel',
{message: 'Would you like to talk to one of our customer support team members on live chat?'})
Disclaimer: I am the Founder of PushRadar.