Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails with real time notifications architecture

I need to add realtime notifications to my Rails app. Here are the different possible architectures I have found.

1. Rails + Socket.io + Redis: As suggested in this post, having the following architecture:

Rails + Socket.io + Redis

  • Pro: Clean, no data is lost if Socket.io is down
  • Con: Introduces several technologies (hardens maintainability)

2. Rails + Socket.io: Making Rails a Socket.io client, as this repo seems to do: https://github.com/lyondhill/socket.io-ruby-client

Rails + Socket.io

  • Pro: Straightforward
  • Con: Relying on a unpopular library

3. Ruby Faye: http://faye.jcoglan.com/ruby.html

  • Pro: 100% Ruby
  • Con: Since an external app is required, Socket.io is much more an industry standard than Faye right now.

4. ActionController::Live: http://edgeapi.rubyonrails.org/classes/ActionController/Live.html

  • Pro: The Rails in app way
  • Con: Too immature

Questions:

  • Is there a standard way (I'd have missed) to do that nowadays?
  • Any thoughts on my comparison (hope this doesn't get closed)?
like image 797
Augustin Riedinger Avatar asked Sep 09 '25 23:09

Augustin Riedinger


1 Answers

Take a look at eventmachine and websockets. There are also third party services such as Pusher and PubNub that will handle the websocket part for you via HTTP API.

https://github.com/igrigorik/em-websocket

Rails 5 will also be adding ActionCable which will do this in rails, but it's not out yet.

I would say the advantage to these approaches is that you don't need a separate node.js app. The services are very easy to use but not free.

like image 72
dinomix Avatar answered Sep 12 '25 13:09

dinomix