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?
migrated from stackoverflow.com Aug 29 '11 at 17:37
|
Rails + EventMachine Pro
Cons
Node.js Pro
Cons
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 Socket.io 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 :) |
|||
|
|
|
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 http://faye.jcoglan.com/ 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 http://pusher.com/ which expose API's for you do do real time messaging. |
|||
|
|

inspire answers that explain “why” and “how”.checktend to have long, not short, answers.probably checkhave a constructive, fair, and impartial tone.should be, yesinvite sharing experiences over opinions.you really would like that hereinsist 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