Last active
December 20, 2015 19:49
-
-
Save yairEO/6186034 to your computer and use it in GitHub Desktop.
get Passport login details within socket.IO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
io.sockets.on('connection', function (socket){ | |
try{ | |
var profileCookie = cookie.parse(socket.handshake.headers['cookie']), | |
profile; | |
if( profileCookie && profileCookie['connect.sess'] ){ | |
profile = profileCookie['connect.sess']; | |
profile = JSON.parse(profile.slice(profile.indexOf('{'), profile.indexOf('}.') + 1)); | |
} | |
} | |
catch(err){} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment