GET http://localhost:3000/socket.io/socket.io.js 404 (Not Found)

Your setup needs to look something like this:

var app     = express();
var server  = require('http').createServer(app);
var io      = require('socket.io').listen(server);
...
server.listen(app.get('port')); // not 'app.listen'!

Can you try this:

var http = require('http');
var app = express();
var server = http.createServer(app);

var io = require('socket.io').listen(server);

I guess, you will have to instantiate the socket.io server.


  • You need to instantiate the socket.io connection and
  • You need to use server.listen() and not app.listen()

Try something like this:

// at the top of app.js
var app     = express();
var server  = require('http').createServer(app);
var io      = require('socket.io').listen(server);

// your code

// at the bottom of app.js
server.listen('3000', () => {
  console.log('Server listening on Port 3000');
})