title: How to send cookies when connecting to socket.io via WebSockets?
body: <p>Is there a way to easily pass an authentication cookie when handshaking a WebSocket connection to socket.io? I currently have to do it separately, like so:</p>
  
  <pre><code>socket = new io.Socket(document.location.hostname);
  socket.addEvent("connect", function()
  {
      // Send PHP session ID, which will be used to authenticate
      var sessid = readCookie("PHPSESSID");
      this.send("{'action':'authenticate','sessionid':'"+sessid+"'}");
  });
  </code></pre>