Live data from Hacker News

A Node.js speed dilemma: AJAX or Socket.IO?

cubrid.org

1–10 of 19 posts

Re: A Node.js speed dilemma: AJAX or Socket.IO?

#4
Main advantage of Socket.IO is that you can do a push to the client over a persistent connection, that is not possible with Ajax in this way. Your results shows that, if you only need pulls from the clients, you could easily use ajax with all the landscape like jQuery and so on and it's not necessary to use Socket.IO.

Re: A Node.js speed dilemma: AJAX or Socket.IO?

#6
"AJAX is usually faster than Socket.IO to “code”..."

I tried node.js and some modules a couple of weeks ago. It was pretty easy to set up and I had a "working" chat application in few hours with socket.io. It was 20-30 lines of code, provided callback to send data immediately to other clients.

I don't think polling the server every 500 ms is a good practice, say 5-10 sec or more can be reasonable, but with socket.io you got it instant.

Re: A Node.js speed dilemma: AJAX or Socket.IO?

#7

"transport" of Socket.IO plays major role (but, it's not smooth/plug 'n play). Benchmark missing note about chosen transport.

Was going to mention this as well.

socket.io falls back to long polling, so you have to be careful when trying to produce benchmarks based only on websockets. I didn't see this in the server code so I assume the default transports were used.

io.configure(ENV, function(){ io.set('transports', ['websocket']); });

more here: https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Soc...

Also, Firefox version would be nice to know.

Post reply on HN