Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 214
user739217 Avatar asked May 05 '11 05:05

user739217


People also ask

Does Socket.IO use XMPP?

As it was written above socket.io is a chat server implementation using Websockets, while XMPP is a protocol. I'd recommend using an XMPP chat server in this case. For audio/video calls implementation you will need to implement signaling via XMPP to establish connection between the devices before the call.

Which is better Socket.IO or WS?

Socket.IO is way more than just a layer above WebSockets, it has different semantics (marks messages with name), and does failovers to different protocols, as well has heartbeating mechanism. More to that attaches ID's to clients on server side, and more. So it is not just a wrapper, it is full-featured library.

What is the difference between Socket.IO and socket IO client?

socket-io. client is the code for the client-side implementation of socket.io. That code may be used either by a browser client or by a server process that is initiating a socket.io connection to some other server (thus playing the client-side role in a socket.io connection).


2 Answers

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.

like image 100
mikl Avatar answered Oct 13 '22 14:10

mikl


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.

like image 20
James C Avatar answered Oct 13 '22 12:10

James C