mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
updating web sockets so that uid is populated for socket calls
This commit is contained in:
@@ -4,7 +4,8 @@ var SocketIO = require('socket.io').listen(global.server),
|
||||
|
||||
(function(io) {
|
||||
var modules = null,
|
||||
sessionID;
|
||||
sessionID,
|
||||
uid;
|
||||
|
||||
global.io = io;
|
||||
module.exports.init = function() {
|
||||
@@ -27,8 +28,13 @@ var SocketIO = require('socket.io').listen(global.server),
|
||||
|
||||
// Otherwise, continue unimpeded.
|
||||
sessionID = handshakeData.sessionID;
|
||||
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) {
|
||||
global.socket = socket;
|
||||
|
||||
Reference in New Issue
Block a user