node.js - NodeJs, Express, Socket.IO authentication -


i want people login using standard loginform , join socket.io chatroom if authentication successful. dont know how retrieve session when setting socket.io part. far have setup session using:

app.use(express.cookieparser()); app.use(express.session({secret:'my-no-longer-secret-secret'}));  app.post('/login', function(request, response) {     // lookup credentials database     var login = true;     if(login) {         request.session.authorized = true;         request.session.room = request.body['room'];         console.log("sessino authorized: " + request.session.authorized);         console.log("session room " + request.session.room);     }     else {         routes.login(request, response);     }      routes.index(request, response); }) 

i want able retrieve request.session .someinfo here in socket part understand it, not possible. instead have use cookiesession not sure how that.

thank in advance


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -