node.js - In Socket.io, how to get the stored cookie information? -
in node application using express, have stored cookie information. need stored cookie information in socket.io. how can this?
app.use(function (req, res, next) { res.cookie('cookiename','1', { maxage: 50000, httponly: true }); }); io.sockets.on('connection', function (socket) { //here need access cookie.how can });
finally found answer.the below code cookie information.
io.sockets.on('connection', function (socket) { var cookie=socket.handshake.headers['cookie']; });