Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real time ruby apps: CRAMP vs NODE.JS

I was wondering if any of you had insights about which one is better, and what factors should be taken into consideration when using one of these

like image 704
meow Avatar asked May 07 '10 01:05

meow


1 Answers

I can speak more from the other (Node.js) side. I just wrote a gem that integrates with Rails 3 that uses a Node.js back-end for listening to Redis PUBSUB messages and updates the Rails front-end accordingly.

Socket.IO + Node is not hard to integrate with a Rails app (especially if working with jQuery), but depending on your targeted browser base (like IE7), it can be tricky to get working right in all cases, namely because of some weird cases when using Flash Socket as a fallback (usually where WebSockets don't work).

That said, I highly recommend Node.js + Socket.IO. It is super light-weight with a lot of options and flexibility to extend to do almost anything you could want. In my opinion, Rails is a fantastic web framework for building bigger apps that need a computationally heavy front-end. I would not choose to use it for small, event driven applications simply because it uses so much memory for the framework alone. I love Ruby/Rails, but when it comes to needing something for quick and clean event processing/message handling, Node has my vote.

If you need more concrete examples, my project Kthxbye (a Resque-esque clone) communicates with Redis which in turn is listened to by Node.JS which in turn can update a web application.

Plugin: http://github.com/plukevdh/kthxbye (see: http://github.com/plukevdh/kthxbye/blob/master/lib/generators/kthxbye/templates/kthxbye.js)

Node Backend: http://github.com/plukevdh/kthxbye-node (see: http://github.com/plukevdh/kthxbye-node/blob/master/poll.js)

(Apologies for the complete lack of documentation on the node project.)

like image 170
Lukas Avatar answered Oct 01 '22 19:10

Lukas