title: Node.js and web-socket-js simple client server not opening
body: <p>My server.js seems to be correct..</p>
  
  <pre><code>var http = require('http');
  http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
  }).listen(1337, "mysite.com");
  console.log('Server running at mysite.com:1337/');
  </code></pre>
  
  <p>The meat of my client is below.</p>
  
  <pre><code>function init() {
  
    // Connect to Web Socket.
    // Change host/port here to your own Web Socket server.
    ws = new WebSocket("ws://mysite.com:1337");
  
    // Set event handlers.
    ws.onopen = function() {
      output("onopen");
    };
  
  }
  </code></pre>
  
  <p>If I go to <a href="http://www.mysite.com:1337" rel="nofollow">http://www.mysite.com:1337</a> I correctly receive Hello World!  However, when I try to connect using my client, and debug in Fire bug, I get the following output.</p>
  
  <pre><code>[WebSocket] connected
  [WebSocket] request header: GET / HTTP/1.1 Upgrade: WebSocket Connection: Upgrade Host: mysite.com:1337 Origin: http://www.mysite.com Cookie: Sec-WebSocket-Key1: 115 17 p^!x-93 IERc16 7 Sec-WebSocket-Key2: 1 75 7Z i `. 8u $l031 4j9
  [WebSocket] sent key3: ±Ôñ&lt;g
  [WebSocket] closed
  </code></pre>
  
  <p>And the WebSocket is automatically closed before I have any chance to do anything.  Can anyone please shed some light on the error I am receiving and what do you think I should do?</p>