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

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

java - SmsManager sending message more than one -