Been Googling for a while in order to find an answer to this question but I still can't get to find the matter in my code. I'm trying to make my very first Socket.io app that simply outputs a message to the console when a user connects.
Here's the error I get from Node.js:
And here is my source code:
var port = process.argv[2];
var express = require('express');
var app = express();
var path = require('path');
app.get('/', function(req, res) {
res.render('index.ejs');
})
.use(app.static(path.join(__dirname, '/public')));
var io = require('socket.io')(app.listen(port));
io.on('connection', function(socket) {
console.log('Someone connected');
});
console.log('Listening on port ' + port);
Thanks in advance for your advice!