var chat = require('socket.io').listen(80) .of('/chat') .on('connection', function(socket) { socket.on('message', function(msg) { socket.get('roomName', function(err, name) { console.log("[message]", name); chat.in(name).send(msg); }); }); socket.on('disconnect', function() { console.log("[disconnect]", socket.id); socket.get('roomName', function(err, name) { socket.leave(name); socket.broadcast.t