updating web sockets so that uid is populated for socket calls

v1.18.x
Julian Lam 12 years ago
parent f4b14df195
commit 33f155b2d1

@ -4,7 +4,8 @@ var SocketIO = require('socket.io').listen(global.server),
(function(io) { (function(io) {
var modules = null, var modules = null,
sessionID; sessionID,
uid;
global.io = io; global.io = io;
module.exports.init = function() { module.exports.init = function() {
@ -27,7 +28,12 @@ var SocketIO = require('socket.io').listen(global.server),
// Otherwise, continue unimpeded. // Otherwise, continue unimpeded.
sessionID = handshakeData.sessionID; sessionID = handshakeData.sessionID;
accept(null, true); global.modules.user.get_uid_by_session(sessionID, function(session_uid) {
if (session_uid) uid = session_uid;
else uid = 0;
accept(null, true);
});
}); });
io.sockets.on('connection', function(socket) { io.sockets.on('connection', function(socket) {

Loading…
Cancel
Save