title: http Post and socket IO
body: <p>now I am learning how to build single page web applications with node.js. When I come to the communication part between server and client, I am confusing about the difference between http post request and web socket communication</p>
  
  <p>Here is my understanding:</p>
  
  <ul>
  <li>Web socket like socket.io is asynchronous communication while POST is synchronous communication method.</li>
  <li>socket.io is mainly used in dealing with real-time task like html games or dynamic online chatting, or boradcasting some informations.</li>
  <li>for validating forms when some user sign up for certain website, it is really good to check instantly if the user name is already been taken or not, I think it is using socket.io to achieve that.</li>
  <li>for example in a login page, after I press the username and password, then press 'login' button, I could just use emit things in socket.io to transfer a JSON file with these information. when we checked these information and send back a flag string like 'true' or 'false ' to indicate if the login is success or not.</li>
  </ul>
  
  <p>So my question is: </p>
  
  <ol>
  <li>Why we still use HTTP POST for login and signup ?</li>
  <li>Is socket.io better than HTTP POST ? </li>
  <li>Why not replace HTTP POST with socket.io ?</li>
  </ol>
  
  <p>P.S for some large files, I have not go into these parts, so I have no idea.</p>
  
  <hr>
  
  <p>Here is some additions:</p>
  
  <p>After reading a <a href="https://stackoverflow.com/questions/14703627/websockets-protocol-vs-http">similar question</a> I find I seem to assume that WebSocket is a replacement for HTTP. It is not. It's an extension. </p>
  
  <p>I think this asnwered my third question <em>Why not replace HTTP POST with socket.io.</em></p>