node.js - Reading a cookie on socket.io -


i stuck scratching head dealing cookies. understand how read cookies within "auth" function below, can read cookie named "identity". problem face cannot access same cookie within of io.sockets.on() function. cookie holds openid value, representing user.

io.configure(function () {   function auth (data, fn) {     var cookies = parse_cookies(data.headers.cookie);     console.log('identity: ' + cookies.identity);          client.hget('user:'+cookies.identity, 'verified', function (err , reply) {             fn(null, reply == 1);             });   };   io.set('authorization', auth); });   io.sockets.on('connection', function (socket) {     client.get('user:'+**cookie here**+':name', function (err , reply) {         socket.emit('example', reply);        }); }); 


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -