title: HTTP: what are the relations between pipelining, keep-alive and Server Sent Events?
body: <p>I am trying to understand what are the HTTP pipelining and HTTP keep-alive connections, and trying to establish a connection between these two topics and Server Sent events technology.</p>
  
  <p>As far as I understand,
  <strong>HTTP keep-alive connection</strong> is the default in HTTP 1.1 way of using TCP when the established once TCP connection is used for sending several HTTP requests one by one.
  <strong>HTTP pipelining</strong> is the capability of client to send requests to server while responses to previous requests were not yet received using the same TCP connection, generally not used as a default way in browsers.</p>
  
  <p>My questions:</p>
  
  <p>1) if it is possible to send several requests to server one after one using one TCP connection - how the client can distinguish between the responses? I guess client is using FIFO order of sending responses by server? </p>
  
  <p>2) Why non-idempotent requests such as POST requests shouldn't be pipelined (according to wikipedia)?</p>
  
  <p>3) What about the limitations of the web-server: is the number of possible open TCP connections limited? If yes, then if some number of clients hold keep-alive connections others cannot establish connections, and this can result in a problem, right? </p>
  
  <p>4) Server Sent Events are using the keep-alive connection but, as far as I understand, SSE are not using pipelining. Instead they manage to process several responses to one request, or may be they just send another request when the next response with event arrived. Which guess is correct?</p>
  
  <p>5) One TCP connection means one socket? One socket means one TCP connection? Closing/opening socket means closing/opening TCP connection?</p>