passing sessions to view and back to server socket.io

I'm trying to pass a session variable from the server to a client side script.

Basically, the first time someone goes to the page, he will be prompted for a user name via prompt(). The username will be set on the server in a session variable.

client:

socket.on('confirmauth', function(data){
    if(!data.username) {
        data.username = prompt("user name?");
        console.log(data.username);
        socket.emit('authenticate', data.username);
    }
    else {
        console.log(data.username);
    }

    // [...]

});

server:

// [...]
app.use(session({
  secret: 'secret',
  resave: false,
  saveUninitialized: true
}))

// [...]

io.sockets.on('connection', function(socket){

    socket.on('waitforauth', function(){
        // when session.username is already set
        socket.emit('confirmauth', {username: session.username});
    });

    // when session.username is not set yet
    socket.on('authenticate', function(data){
        session.username = data;
        console.log(session);
    })

    // [...]

});

I am using express-session

the problem is that right now the session.username is the same across all clients.

There cannot be more than one user it seems.

To be reprompted for a username I have to restart the server instead of simply closing the browser.

any help appreciated.