title: Why is my Websocket connection not working in the Developer Console?
body: <p>I'm trying to connect to a server using websockets. I've set up the port on the server, and am trying to connect through the Dev console in Chrome (also tried Firefox and got the same result).</p>
  
  <p>I connect from the console using:</p>
  
  <pre><code>var websocket = new WebSocket('ws://localhost:5001');
  </code></pre>
  
  <p>This gives me the message "undefined". However, if I do</p>
  
  <pre><code>websocket.readyState
  </code></pre>
  
  <p>I get "1".</p>
  
  <p>I then do</p>
  
  <pre><code>websocket.binaryType = 'arraybuffer';
  </code></pre>
  
  <p>which prints <code>"arraybuffer"</code>.</p>
  
  <p>If I then do something like</p>
  
  <pre><code>websocket.send("1+1");
  </code></pre>
  
  <p>it says <code>undefined</code>.</p>
  
  <p>However, if I do all of this in an HTML file with JavaScript, it connects fine and I get the result "2", so it looks as though the Websocket itself is ok, and what I'm typing in is ok, but it's something to do with it being in the Dev Console that's the issue.</p>
  
  <p>I don't know anything much about setting up Websockets.</p>