Saturday 30 January 2016

Socket.IO Beginner help

Hello guys, I am new to Socket.io and have a problem. I think it's solveable rather easily but I have been struggling with fixing it for the past hour... This is the code: var express = require('express'); var app = express(); var http = require('http').Server(app); var io = require('socket.io')(http);app.use(express.static(__dirname + '/www.csgolobby.com')); app.get('/', function(req, res){ res.sendFile(__dirname + '/index.html'); }); io.on('connection', function(socket){ console.log('a user connected'); }); http.listen(3000, function(){ console.log('listening on *:3000'); }); The problem I am having is that I don't get the message "a user connected" when I connect. I have gotten that part of the code from the Chat Tutorial on Socket.io. I have changed the vars provided there so I could use all my css/js files from my already existing website in the folder http://ift.tt/1JQ2tr7 is appreciated a lot! _^

Submitted January 30, 2016 at 08:27PM by timgfx

No comments:

Post a Comment