title: cannot connect with web socket using socket.io
body: <p>I am new to <code>javaScript</code>. I have written 2 js files to test out web sockets.</p>
  <p><code>server.js</code></p>
  <pre class="lang-js prettyprint-override"><code>const io = require('socket.io')(8000)
  
  const users = {}
  
  io.on('connection', socket =&gt; {
          console.log('new user')
  })
  
  io.on('disconnect', socket =&gt; {
      console.log(&quot;user left&quot;)
  })
  </code></pre>
  <p><code>client.js</code></p>
  <pre><code>var socket = io('https://localhost:8000', { transports : ['websocket'] });
  </code></pre>
  <p>However, the connection cannot be established.
  Error messages:</p>
  <p>chrome</p>
  <blockquote>
  <p><code>WebSocket connection to 'wss://localhost:8000/socket.io/?EIO=4&amp;transport=websocket' failed:</code></p>
  </blockquote>
  <p>firefox</p>
  <blockquote>
  <p><code>Firefox can’t establish a connection to the server at wss://localhost:8000/socket.io/?EIO=4&amp;transport=websocket. 2 </code></p>
  </blockquote>
  <p>I am working on <code>ubuntu 20.04</code></p>