Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.  
  2. io.configure(function() {
  3.  
  4.   io.set('authorization', function(handshakeData, callback) {
  5.  
  6.     if (handshakeData.headers.cookie) {
  7.  
  8.       req_cookie =  cookie.parse(decodeURIComponent(handshakeData.headers.cookie));
  9.  
  10.       req_session = parseSignedCookie(req_cookie['connect.sid'], SECRET);
  11.  
  12.       sessionStore.get(req_cookie['connect.sid'], function(err, session) {
  13.  
  14.         if (session) {
  15.          
  16.           req = {
  17.             sessionStore: sessionStore,
  18.             sessionID: handshakeData.sessionID
  19.           };
  20.  
  21.           session = new express.session.Session(req, session);
  22.           console.log(JSON.stringify(session));
  23.           //handshakeData.session = new Session(handshakeData, session);
  24.         }
  25.         if (err || !session) {
  26.           console.log(JSON.stringify(session));
  27.           console.log(JSON.stringify(err));
  28.           console.log( 'Error!!!');
  29.           return callback(err, false);
  30.         }
  31.         else {
  32.          
  33.           handshakeData.session = new Session(data, session);
  34.           return callback(null, true);
  35.         }
  36.  
  37.       });
  38.     } else {
  39.      
  40.       return callback('No cookie transmitted', false);
  41.     }
  42.   });
  43. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top