user739217
user739217

Reputation: 221

Node.js with Socket.io module vs XMPP - advantages and disadvantages

I have a Node.js with Socket.io chat application and an XMPP Openfire chat system. I'm looking forward to replacing XMPP with Node.js and Socket.io. However, there is talk that, Node.js with Socket.io would have a problem, if the server crashes and goes back online it would have a bottleneck syndrome or maybe impossible to reconnect 10,000 of it's online users. Is that true?

Another question. In what case would XMPP be more appropriate than Socket.io and vice versa?

Upvotes: 22

Views: 19073

Answers (4)

user847585
user847585

Reputation: 31

You can also check the xmppjs library designed to work with node.js. http://xmppjs.prosody.im/

Upvotes: 3

Nick Campbell
Nick Campbell

Reputation: 537

As mikl said, XMPP is a protocol and not an application framework.

You can build XMPP applications on top of NodeJS in the same way that you can build SocketIO applications on top of NodeJS. The difference is that OpenFire and ejabberd have been around and tested for some time versus some solution you'd build on your own. That doesn't mean you should do it, but it does mean you should have a good business case for doing so.

If you're setting your infrastructure up properly, you can do this in pretty much any framework. To mitigate your latency during spikes you should load balance your requests which will also likely be required with any system.

Upvotes: 5

James C
James C

Reputation: 14149

I think that the pros of Node.js are that it's written in a commonly understood language (Javascript) rather than XMPP servers which the common ones are written in erlang/Java which aren't so widely understood.

If you want to have full control over the server behaviour and write clever modules then I suspect that node will be the best solution for you.

The place that Node.js could fall down is that if you ever need to scale beyond one server you're going to have to engineer this into your node app. I believe that eJabberd and Openfire both support clustering out of the box so all you'd need to do is bring another server online, configure the two to talk to each other and off you go.

My overall advice to you would be that if the current XMPP system is working fine for you then I'd just stick with it.

Upvotes: 11

mikl
mikl

Reputation: 24267

XMPP is an open-standard communications protocol for message-oriented middleware (Wikipedia).

Node.js is a JavaScript-based developer tool for creating network services.

Those two things don't really compare. If you have built a chat application with socket.io, it's possible that it'll suffer from bottleneck syndrome, but it depends a lot on your application code.

In general, if you want to go beyond simple browser-based chat, I'd seriously consider XMPP (aka. Jabber), since there XMPP clients readily available for all OS'es.

Upvotes: 13

Related Questions