Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- io.configure(function() {
- io.set('authorization', function(handshakeData, callback) {
- if (handshakeData.headers.cookie) {
- req_cookie = cookie.parse(decodeURIComponent(handshakeData.headers.cookie));
- req_session = parseSignedCookie(req_cookie['connect.sid'], SECRET);
- sessionStore.get(req_cookie['connect.sid'], function(err, session) {
- if (session) {
- req = {
- sessionStore: sessionStore,
- sessionID: handshakeData.sessionID
- };
- session = new express.session.Session(req, session);
- console.log(JSON.stringify(session));
- //handshakeData.session = new Session(handshakeData, session);
- }
- if (err || !session) {
- console.log(JSON.stringify(session));
- console.log(JSON.stringify(err));
- console.log( 'Error!!!');
- return callback(err, false);
- }
- else {
- handshakeData.session = new Session(data, session);
- return callback(null, true);
- }
- });
- } else {
- return callback('No cookie transmitted', false);
- }
- });
- });
Add Comment
Please, Sign In to add comment