title: GET http://localhost:8563/socket.io/?EIO=3&transport=polling&t=NEsUPis 404 (Not Found)
body: <p>I've spent days trying to figure out why this is not working, but I didn't get anything out of it.<br>
  I tried some other answers about this topic, but none seemed to work for me.<br>
  Answers tried:<br>
  <a href="https://stackoverflow.com/questions/27393705/how-to-resolve-a-socket-io-404-not-found-error">How to resolve a Socket.io 404 (Not Found) error?</a></p>
  <p><a href="https://stackoverflow.com/questions/11653237/socket-io-failed-to-load-resource">socket.io: Failed to load resource</a></p>
  <p><a href="https://stackoverflow.com/questions/16981396/get-http-localhost3000-socket-io-socket-io-js-404-not-found">GET http://localhost:3000/socket.io/socket.io.js 404 (Not Found)</a></p>
  <p><a href="https://stackoverflow.com/questions/56068716/error-http-localhost3001-socket-io-404-not-found">Error: http://localhost:3001/socket.io/ 404 (Not Found)</a></p>
  <p><a href="https://stackoverflow.com/questions/50846572/socket-io-http-localhost3000-socket-io-socket-io-js-404-not-found-how-to">Socket.io http://localhost:3000/socket.io/socket.io.js 404 (Not Found) - How to configure socket.IO - nodejs, apache2, websockets</a></p>
  <p><a href="https://stackoverflow.com/questions/44913881/socket-io-404-not-found">Socket.io 404 Not Found</a></p>
  <p>This is my code.
  File server.js:</p>
  <pre><code>//Dependencies
  var express = require('express');
  var io = require('socket.io').listen(server);
  //Dependencies
  
  //Global variables
  var app = express();
  var PORT = 3000;
  const ROOT = {root : __dirname};
  var players = [];
  //Global variables
  
  var server = app.listen(PORT, function() {
      console.log(&quot;Server process started successfully on port &quot; + PORT + &quot;\n&quot;);
  });
  
  app.get('/', function(req, res) {
      console.log(&quot;Server called from &quot; + req.socket.remoteAddress + &quot;:&quot; + req.socket.remotePort + &quot;\n&quot;);
      res.sendFile('html/access.html', ROOT);
  });
  
  app.get('/gameSelection', function(req, res) {
      let name = req.query.name;
      players.push(name);
      console.log(&quot;New player named &quot; + name + &quot; joined the hub.&quot; + &quot;\n&quot;);
      console.log(&quot;Total active players: &quot; + players.length + &quot;\n&quot;);
      console.log(&quot;Complete list of active players: &quot; + players + &quot;\n&quot;);
      res.sendFile('sketches/menu/index.html', ROOT);
  });
  
  app.use(express.static(__dirname + '/sketches/menu'));
  
  io.sockets.on('connection', function(socket){
      console.log(&quot;We have a new client: &quot; + socket.id);
  });
  </code></pre>
  <p>File access.html:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Welcome traveler&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form method=&quot;GET&quot; action=&quot;/gameSelection&quot;&gt;
              Name: &lt;input type=&quot;text&quot; name=&quot;name&quot; placeholder=&quot;Insert your name...&quot; required&gt;
              &lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>File menu.js:</p>
  <pre><code>const socket = io.connect(window.location.origin);
  
  function setup()
  {
      createCanvas(600, 400);
      ellipse(100, 100, 50, 50);
  }
  
  function draw() {}
  </code></pre>
  <p>File index.html:</p>
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
  
    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;libraries/p5.min.js&quot;&gt;&lt;/script&gt;
    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;https://cdn.socket.io/socket.io-1.4.5.js&quot;&gt;&lt;/script&gt;
    &lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;menu.js&quot;&gt;&lt;/script&gt;
  
    &lt;style&gt; body { padding: 0; margin: 0; } &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>As shown by the code, I'm trying to connect via socket.io a p5js page to my node server.<br>
  But when I get to the index.html page I get this error:<br></p>
  <blockquote>
  <p>GET http://localhost:3000/socket.io/?EIO=3&amp;transport=polling&amp;t=NEsXBrx 404 (Not Found)<br>
  Request.create @ socket.io-1.4.5.js:1<br>
  Request @ socket.io-1.4.5.js:1<br>
  XHR.request @ socket.io-1.4.5.js:1<br>
  XHR.doPoll @ socket.io-1.4.5.js:1<br>
  Polling.poll @ socket.io-1.4.5.js:1<br>
  Polling.doOpen @ socket.io-1.4.5.js:1<br>
  Transport.open @ socket.io-1.4.5.js:1<br>
  Socket.open @ socket.io-1.4.5.js:1<br>
  Socket @ socket.io-1.4.5.js:1<br>
  Socket @ socket.io-1.4.5.js:1<br>
  Manager.open.Manager.connect @ socket.io-1.4.5.js:2<br>
  (anonymous) @ socket.io-1.4.5.js:3<br></p>
  </blockquote>
  <p>I really cannot understand what's wrong with my code, so I hope someone can help.<br>
  Thanks in advance.</p>