How do you get the request data with socket.io with node.js and express?

Viewed 9747

So I have this problem using express with socket.io. I think it is pretty self explanitory; I simply need to get the session and request parameter data to socket.io. This cannot be done on the client side as some rooms are going to be private. Any solutions?

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

  socket.on('send message', function(data) {
    NEED USER ID STORED IN session.user
  }
})

app.get('/:roomid', function (req, res) {
  //req.session.user = THE USER ID
  //req.params.roomid = THE ROOM ID
})
1 Answers
Related