title: My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets
body: <p>I have read many posts on SO and the web regarding the keywords in my question title and learned a lot from them. Some of the questions I read are related to specific implementation challenges while others focus on general concepts. I just want to make sure I understood all of the concepts and the reasoning why technology X was invented over technology Y and so on. So here goes:</p>
  
  <p><strong>Http Polling:</strong> Basically AJAX, using XmlHttpRequest.</p>
  
  <p><strong>Http Long Polling:</strong> AJAX but the server holds on to the response unless the server has an update, as soon as the server has an update, it sends it and then the client can send another request. Disadvantage is the additional header data that needs to be sent back and forth causing additional overhead.</p>
  
  <p><strong>Http Streaming:</strong> Similar to long polling but the server responds with a header with "Transfer Encoding: chunked" and hence we do not need to initiate a new request every time the server sends some data (and hence save the additional header overhead). The drawback here is that we have to "understand" and figure out the structure of the data to distinguish between multiple chunks sent by the server.</p>
  
  <p><strong>Java Applet, Flash, Silverlight:</strong> They provide the ability to connect to socket servers over tcp/ip but since they are plugins, developers don't want to depend on them.</p>
  
  <p><strong>WebSockets:</strong> they are the new API which tries to address the short comings of above methods in the following manner:</p>
  
  <ul>
  <li>The only advantage of WebSockets over plugins like Java Applets, Flash or Silverlight is that WebSockets are natively built into browsers and does not rely on plugins.</li>
  <li>The only advantage of WebSockets over http streaming is that you don't have to make an effort to "understand" and parse the data received.</li>
  <li>The only advantage of WebSockets over Long Polling is that of elimination of extra headers size &amp; opening and closing of socket connection for request.</li>
  </ul>
  
  <p>Are there any other significant differences that I am missing? I'm sorry if I am re-asking or combining many of the questions already on SO into a single question, but I just want to make perfect sense out of all the info that is out there on SO and the web regarding these concepts.</p>
  
  <p>Thanks!</p>