title: GET http://js:port/socket.io/1/ 404 not found
body: <p>Socket.io is having issues connecting up.</p>
  
  <p><strong>This is my Server code:</strong> </p>
  
  <pre><code>function chatserver(){
  
  var express = require('express'),
  
  app = express(),
  
  server = require('http').createServer(app).listen(app.get('port'),function(){
  
          console.log('Express server listening on port '+ app.get('port'));
      });
  var io = require('socket.io').listen(server),
      users = {};
  
  io.sockets.on('connection', function(socket){
      socket.on('new user', function(data, callback){
          if (data in users){
              callback(false);
          } else{
              callback(true);
              socket.nickname = data;
              users[socket.nickname] = socket;
              updateNicknames();
          }
      });
  
      function updateNicknames(){
          io.sockets.emit('usernames', Object.keys(users));
      }
  
      socket.on('send message', function(data, callback){
          var msg = data.trim();
          console.log('after trimming message is: ' + msg);
          if(msg.substr(0,3) === '/w '){
              msg = msg.substr(3);
              var ind = msg.indexOf(' ');
              if(ind !== -1){
                  var name = msg.substring(0, ind);
                  var msg = msg.substring(ind + 1);
                  if(name in users){
                      users[name].emit('whisper', {msg: msg, nick: socket.nickname});
                      console.log('message sent is: ' + msg);
                      console.log('Whisper!');
                  } else{
                      callback('Error!  Enter a valid user.');
                  }
              } else{
                  callback('Error!  Please enter a message for your whisper.');
              }
          } else{
              io.sockets.emit('new message', {msg: msg, nick: socket.nickname});
          }
      });
  
      socket.on('disconnect', function(data){
          if(!socket.nickname) return;
          delete users[socket.nickname];
          updateNicknames();
      });
  });
  }
  </code></pre>
  
  <p>My HTML script code: </p>
  
  <pre><code>jQuery(function($){
  
          var socket = io.connect('js/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js');
  
          var $nickForm = $('#setNick');
          var $nickError = $('#nickError');
          var $nickBox = $('#nickname');
          var $users = $('#users');
          var $messageForm = $('#send-message');
          var $messageBox = $('#message');
          var $chat = $('#chat');
  
          $nickForm.submit(function(e){
              e.preventDefault();
              socket.emit('new user', $nickBox.val(), function(data){
                  if(data){
                      $('#nickWrap').hide();
                      $('#contentWrap').show();
                  } else{
                      $nickError.html('That username is already taken!  Try again.');
                  }
              });
              $nickBox.val('');
          });
  
          socket.on('usernames', function(data){
              var html = '';
              for(i=0; i &lt; data.length; i++){
                  html += data[i] + '&lt;br/&gt;'
              }
              $users.html(html);
          });
  
          $messageForm.submit(function(e){
              e.preventDefault();
              socket.emit('send message', $messageBox.val(), function(data){
                  $chat.append('&lt;span class="error"&gt;' + data + "&lt;/span&gt;&lt;br/&gt;");
              });
              $messageBox.val('');
          });
  
          socket.on('new message', function(data){
              $chat.append('&lt;span class="msg"&gt;&lt;b&gt;' + data.nick + ': &lt;/b&gt;' + data.msg + "&lt;/span&gt;&lt;br/&gt;");
          });
  
          socket.on('whisper', function(data){
              $chat.append('&lt;span class="whisper"&gt;&lt;b&gt;' + data.nick + ': &lt;/b&gt;' + data.msg + "&lt;/span&gt;&lt;br/&gt;");
          });
      });
  </code></pre>
  
  <p>When I load up the website at first it's OK. But as soon as I click the chat box, in inspect elements/console I get to see <code>"GET http://'js':5001/socket.io/1/?.."</code> error appear. Please advise.</p>