I want to use req.user.id inside
io.sockets.on('connection', module.exports = function(socket){}
so I tried to using this line socket.request.client.user
like that on
io.sockets.on('connection', module.exports = function(socket,client,req){
//con
connections.push(socket);
//app.use(session);
app.use(session({ secret: 'keyboard cat',resave: true, saveUninitialized:true})); // session secret
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
console.log('connected: %s socket connected -session',socket.request.client.user ,connections.length);
but i get undefined on console
via dark night
No comments:
Post a Comment