Created
July 25, 2014 19:02
-
-
Save anonymous/924a24b8f59fb07f1b58 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('express')(); | |
var http = require('http').Server(app); | |
var io = require('socket.io')(http); | |
app.get('/', function(req, res) { | |
res.sendfile('index.html'); | |
}); | |
io.on('connection', function(socket) { | |
console.log('um usuario conectado'); | |
socket.on('disconnect', function() { | |
console.log('usuario desconectado'); | |
io.emit('usuario desconectado'); //AQUI OCORRE O ERRO | |
}); | |
socket.on('chat message', function(msg) { | |
console.log('message: ' + msg); | |
io.emit('chat message', msg); | |
}); | |
}); | |
http.listen(3000, function() { | |
console.log('Rodando na porta: 3000'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment