Using the basic chat example from the socket.io website, it initially worked for the past few days but now is completely malfunctioning. When console.logging to check if users are connected, I get a never ending 'user connected' status and am unable to post anything to the chat. here's the code:
var app = require('express')();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var port = process.env.PORT || 3000;
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function(socket){
console.log('user connected');
socket.on('chat message', function(msg){
io.emit('chat message', msg);
});
});
server.listen(port, function(){
console.log('listening on *:' + port);
});
I answered my own question in that I was using a brand new version of socket.io that apparently has bugs, because an older version ended up working with the same code.