title: Connect from plain javascript to socket.io backend? - Connection closed before handshake
body: <p>I am trying to connect my client side javascript to a backend websocket service hosted using socket.io .</p>
  
  <p>I am trying to use the native WebSocket object to connect to the socket.io server like :</p>
  
  <pre><code>new WebSocket("wss://localhost:8080/socket.io/websocket")
  </code></pre>
  
  <p>But I keep getting :</p>
  
  <blockquote>
    <p>Connection closed before receiving a handshake response</p>
  </blockquote>
  
  <p>I have tried connecting using the client side socket.io library just to confirm that the server is up and fine, and this works, but in production I only have the WebSocket object available.</p>
  
  <p>Any ideas?</p>