Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a chat room for a Rails app is implemented the old-fashioned way, using Ajax Polling. This is not scaling, and it is cluttering my log, so I want to reimplement using either EventMachine + HTML5 websocket/degrade to flash, or Node.js. Given that the rest of the app is in Rails, what are the the pros and cons of each of these two alternatives?


migration rejected from Sep 1 '14 at 11:59

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as too broad by gnat, GlenH7, MichaelT, ratchet freak, BЈовић Sep 1 '14 at 11:59

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

This appears to be a better match for programmers: inspire answers that explain “why” and “how”. check tend to have long, not short, answers. probably check have a constructive, fair, and impartial tone. should be, yes invite sharing experiences over opinions. you really would like that here insist that opinion be backed up with facts and references. duh. are more than just mindless social fun. well you are writing a chat server :p ... anyways, I say this is a better fit there, because you're discussing architecture more than anything. – jcolebrand Aug 29 '11 at 17:33
of additional note, we've just started a project on github for StackChat as part of the recent #NodeKnockout 2011 competition so that may be of use to you. – jcolebrand Aug 29 '11 at 17:38
Dan, what problems are you running into with your current implementation that you're hoping to solve with other approaches? – Adam Lear Aug 29 '11 at 17:38

I only just started to play with Node.js, but I have experience as a Ruby programmer, and have been delving deeper into EM, a lot lately, I will admit if you don't have a lot of experience with it or the reactor pattern it will have a bit of a learning curve from your normal synchronous ruby code. With node.js out of the box it has some great tools for running everything asynchronously.

Or you can alway go a little be easier, and use a simple prebuilt system for handling pubsub sort of jobs like a chat room, and use Faye which you run as a separate Rack app using Thin as a server... or if you like this approach, but don't want to manage Faye, you can use an external service like Pusher which expose API's for you do do real time messaging.


Rails + EventMachine


  • It's Ruby


  • Ruby has poor threading :( It's getting better though, over time




  • It's Javascript, need to learn a little
  • Not as easy to debug

Even though you would be introducing something outside the normal rails, I would consider node.js or Erlang for this. Erlang will also scale like nobody's business for this sort of thing. Erlang isn't as good for some of the other web app stuff though, sticking with rails for that is a good call.


I would use Node.js. Considering the amount of fame Node.js and have been gaining in the recent days, I can say that it will stay for a long while. Its really easy to learn and program, somewhat easier to debug than EventMachine. Lastly the huge usage and community ensures that it pretty much works on every browser and OS. This is a big plus for me as I spend days solving mundane IE bugs because of the way out application was written.

At the moment I will be Weary of using HTML 5 in an applications used by 100's of people cause not every one uses the latest browser.

Flash, no. Unless you have a lot of flash developers.


I think both Node.js and EvenMachine will get the job done, I would really suggest you to go with the language you are more familiar with or even better the one you like working with :)


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