title: Node.js app fails to connect using socket.io-client
body: <h2>Background</h2>
  
  <p>I have a Node.js server using <code>socket.io</code> that accepts connections from clients via HTTPS. </p>
  
  <p>I know this server works as I am able to connect to it via browser. </p>
  
  <h2>Problem</h2>
  
  <p>The problem is that I can't create a node app to connect to this server as a client. </p>
  
  <p>I am using the following code:</p>
  
  <pre><code>const io = require("socket.io-client");
  
  const socket = io.connect("https://my.website.com:3002", { secure: true, reconnect: true });
  
  socket.on("connect", function(){
      console.log("connected");
  });
  
  socket.on("disconnect", function(){
      console.log("disconnected");
  });
  
  socket.on("error", console.error);
  </code></pre>
  
  <p>The server registers no connections, and this app logs no errors. It would seem that I am connecting to the wrong server, but this same URL works just fine when I use a browser. </p>
  
  <h2>Research</h2>
  
  <p>I have searched github and the official docs for an answer. Even similar questions from stackoverflow seem to not work:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/10703513/node-js-client-for-a-socket-io-server">Node.js client for a socket.io server</a></li>
  <li><a href="https://www.npmjs.com/package/socket.io-client" rel="noreferrer">https://www.npmjs.com/package/socket.io-client</a></li>
  <li><a href="https://github.com/socketio/socket.io-client/issues/828" rel="noreferrer">https://github.com/socketio/socket.io-client/issues/828</a></li>
  </ul>
  
  <h2>Question</h2>
  
  <p>What am I doing wrong ?</p>