/*var app = require('express');
var http = require('http').Server(app);
var io = require('socket.io').listen(http);
*/

var app = require('express')();
app.set('port', process.env.PORT || 3000);
var server = require('http').createServer(app);
var io = require('socket.io')(server);
server.listen(app.get('port'));

var connectedLobby = {
    connected : [],
    push : function (newConnected){
        if (typeof newConnected === 'object'
            && newConnected.id
            && newConnected.pseudo){
                this.connected.push(newConnected);
        }
    },
    remove : function(pseudo){
        var conn = [];
        this.connected.forEach(function(data){
           if(data.pseudo != pseudo){
               conn.push(data);
           }
        });
        this.connected = conn;
    },
    getPseudoList : function(){
        var conn = [];
        this.connected.forEach(function(data){
                conn.push(data.pseudo);
        });
        return conn;
    },
    getPseudoById: function(id){
        var conn = null;
        this.connected.forEach(function(data){
            if(data.id == id){
                conn = data.pseudo;
            }
        });
        return conn;
    }
}

io.on('connection', function(socket){
  console.log("socket.io connection.....");
    socket.on('Pseudo', function (pseudo){
      //socket.set('pseudo', data);
      connectedLobby.push({pseudo:pseudo, id:socket.id});
    });
    socket.on('message', function(message){
      console.log("received message");
        var pseudo = connectedLobby.getPseudoById(socket.id);
        console.log("user" + pseudo + "send this " + message);
        /*socket.get('pseudo',function(error, name){
            var data = { 'message' : message, pseudo : name};
            socket.broadcast.emit('message',data);
        });*/
    });
});

console.log("listening....");
/*
server.listen(3000, function(){
  console.log('listening on 3000');
});
*/

@@ -1487,47 +1487,8 @@
 e)%7B%0A
-      console.log(%22received message%22);%0A
     
@@ -1570,16 +1570,17 @@
 og(%22user
+ 
 %22 + pseu
@@ -1585,16 +1585,17 @@
 eudo + %22
+ 
 send thi
@@ -1595,16 +1595,18 @@
 end this
+ :
  %22 + mes
@@ -1613,68 +1613,12 @@
 sage
+ 
 );%0A
-        /*socket.get('pseudo',function(error, name)%7B%0A    
     
@@ -1668,19 +1668,19 @@
 o : 
-name%7D;%0A    
+'pseudo'%7D;%0A
     
@@ -1718,24 +1718,77 @@
 age',data);%0A
+        /*socket.get('pseudo',function(error, name)%7B%0A
         %7D);*

change server.js