title: chrome.sockets.tcp.onReceiveError for HTTP connection
body: <p>I am listening for HTTP requests to localhost on a specified port using <code>chrome.sockets.tcpServer</code> running in a Chrome App. I'm basing my app on  the code samples from Google:</p>
  
  <p><a href="https://developer.chrome.com/apps/app_network#tcpServer" rel="nofollow">https://developer.chrome.com/apps/app_network#tcpServer</a>.</p>
  
  <p>The HTTP requests are coming from a single instance of a Flash application. It starts off working okay. When the first request comes through, the Chrome app makes a connection with a client socket, and seems to use this connection for subsequent requests.</p>
  
  <p>Sooner or later though in the same session, Chrome will open another client socket for a given request, then will quickly throw a <code>chrome.sockets.tcp.onReceiveError</code> for the new client socket. Then the original socket will also throw the same error, and no sockets remain connected.</p>
  
  <p>The Flash code is just making a regular HTTP request (it's not specifically asking for a new port).</p>
  
  <p>Does anyone know:</p>
  
  <ul>
  <li>what do I need to do to keep all requests on the same client socket id? </li>
  <li>or how do I get the server to cope with changing sockets?</li>
  </ul>
  
  <p>I've put the server code here if anyone has time to take a look:</p>
  
  <p><a href="https://github.com/tarling/http-test/tree/flash/js" rel="nofollow">https://github.com/tarling/http-test/tree/flash/js</a></p>
  
  <p>I wondered if it was something to do with "Connection: keep-alive" so have included this in the HTTP response header</p>
  
  <p><a href="https://github.com/tarling/http-test/blob/flash/js/http.js#L52" rel="nofollow">https://github.com/tarling/http-test/blob/flash/js/http.js#L52</a></p>
  
  <p>Thanks for any insight</p>