Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am prototyping an application using nodejs. But this question refers to hypothetical large scale roll out. What is more demanding on a server and/or bandwidth: WebSocket stay alive connections or repeated client HTTP GET requests?

For example (maybe an extreme example), is it more efficient for Twitter to allow its clients to send GET requests to its API every 20 secs, or have each client connected on an HTTP1.1 websocket? What about every 1 minute or greater, or less?

BTW, maybe it does not matter, but presuming GET requests will be handled by nginx as supposed to node, would this make a difference?

share|improve this question
What are you rolling out? Are the GETs keep-alive's themselves or are they checking for updated info? – Rob Olmos Nov 30 '10 at 1:30
Just checking for updated info. In the prototype it returns a json response. – Ross Nov 30 '10 at 9:35
up vote 1 down vote accepted

WebSockets are better because you keep connection open and don't send extra protocol headers and other stuff after each request and response. Look at this article:

During making connection with WebSocket, client and server exchange data per frame which is 2 bytes each, compared to 8 kilo bytes of http header when you do continuous polling.

share|improve this answer
great, thanks for the info. – Ross Dec 3 '10 at 10:09

websockets is a better option but it isn't in all browsers yet. If you go that route you'll want to use SocketIO on the client and node.js side. That will provide a failover to flash sockets if the browser does not support websockets yet.

You gain on websockets since the data that gets sent back to the server isn't as big as a get request.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.