I'm doing real time live web app development.
Browser users should be able to communicate with eachother through a node.js server. One of the user writes a message and all other users will get it.
I don't quite get how RabbitMQ works. But from quick reading it seems that it handles publication/subscription of messages.
A user (in a browser) publishes something and subscribers (in other browsers) get that message. Isn't that what Socket.io is doing with websockets?
Here are my questions:
Are there scenarios I need RabbitMQ for web apps where Socket.io doesn't suffice? Browser users should be able to communicate with eachother through a node.js server. One of the user writes a message and all other users will get it.
When you only have these simple requirements then socket.io alone will be enough.. You only need a message queue when you want to process your jobs(heavy) offline and in a controlled manner.
http://en.wikipedia.org/wiki/Message_queue:
Message queues provide an asynchronous communications protocol, meaning that the sender and receiver of the message do not need to interact with the message queue at the same time.
This sentence needs to sink in. The producer (one process) puts a job into the queue and the consumer consumes by taking the job from the queue. The consumer, most times, are multiple processes that consume multiple jobs concurrently. The consumers are unable to tell from each other, what jobs they are consuming.
This makes the queue a First-In-First-Out (FIFO) data structure.
That's I think an important property of the queue. The First-In-First-Out property although with an advanced message queue like beanstalkd you can give jobs priorities.
I hope this makes any sense at all ;)
I'm doing real time live web app development.
Could you explain a little better so that we can give you a better answer?
I don't quite get how RabbitMQ works. But from quick reading it seems that it handles publication/subscription of messages.
See the quote about message queue below. Let it sink in for a while. You could also read the WIKI about message queues.
A user (in a browser) publishes something and subscribers (in other browsers) get that message. Isn't that what Socket.io is doing with websockets?
Socket.io supports a lot of different transports(also websockets) and it should because websockets are not supported by the most browsers. But for example Google Chrome does already support websockets. I believe that websockets are the transport of the future(but not yet!). When you look at Socket.io's browser support page you will notice that Socket.io does support all the major browsers(some even ancient). The nice thing is that it wraps this around a nice API.
What are the advantages/disadvantages for each one of them?
You are comparing apples to oranges so comparing that is kind of strange.
http://www.rabbitmq.com/tutorials/tutorial-one-python.html:
RabbitMQ is a message broker. The principal idea is pretty simple: it accepts and forwards messages. You can think about it as a post office: when you send mail to the post box you're pretty sure that Mr. Postman will eventually deliver the mail to your recipient. Using this metaphor RabbitMQ is a post box, a post office and a postman.
Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms.
Can Socket.io replace RabbitMQ?
No you can't because they are two completely different things. You are comparing apples to oranges. You should try to comprehend both descriptions from the sites I quoted.