title: GET http://localhost/socket.io/?EIO=3&transport=polling&t=LjIvLGU 404 (Not Found)
body: <p>I have a problem with Nodejs and my js code.</p>
  
  <p>When I run the Nodejs in console server does not show any problems, but all time I get an error in the console from Chrome:</p>
  
  <pre><code>GET http://localhost/socket.io/?EIO=3&amp;transport=polling&amp;t=LjIvLGU 404 (Not Found)
  </code></pre>
  
  <p><strong>index.html</strong> </p>
  
  <pre><code>&lt;head&gt;
      &lt;title&gt;test&lt;/title&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://localhost:3000/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p><strong>script.js</strong></p>
  
  <pre><code>var express = require('express');
  var app = express();
  var server = require('http').Server(app);
  var io = require('socket.io').listen(server);
  
  users = [];
  connections = [];
  
  server.listen(process.env.PORT || 3000);
  
  console.log("server up");
  
  app.get('/', function (req, res) {
      res.sendFile(__dirname + '/index.php');
  });
  
  io.sockets.on('connection', function (socket) {
  
      socket.on('subscribe', function (data) {
          socket.join(data.room);
      });
      socket.on('arriv', function (data) {
          console.log(data);
          io.sockets.in('invitor').emit('send message',data);
      });
  
      socket.on('unsubscribe', function (data) {
          socket.leave(data.room);
      });
  });
  </code></pre>
  
  <p><strong>user.js</strong></p>
  
  <pre><code>$(function () {
      var cid = $.session.get('company');
      console.log(cid);
  
      var socket = io.connect();
  
      socket.emit("subscribe", {room: "invitor"});
  
      socket.on("send message", function (data){
          $('#info').append("" + data.gid + "&lt;/br&gt;");
      });
      $(document).on('click', '.123', function () {
          var gid = $(this).attr('id');
          socket.emit('arriv', {gid: gid});
      });
  });
  </code></pre>