mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +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) {
|
(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,8 +28,13 @@ var SocketIO = require('socket.io').listen(global.server),
|
|||||||
|
|
||||||
// Otherwise, continue unimpeded.
|
// Otherwise, continue unimpeded.
|
||||||
sessionID = handshakeData.sessionID;
|
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);
|
accept(null, true);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
io.sockets.on('connection', function(socket) {
|
io.sockets.on('connection', function(socket) {
|
||||||
global.socket = socket;
|
global.socket = socket;
|
||||||
|
|||||||
Reference in New Issue
Block a user