mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +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,7 +28,12 @@ var	SocketIO = require('socket.io').listen(global.server),
 | 
			
		||||
 | 
			
		||||
		// Otherwise, continue unimpeded.
 | 
			
		||||
		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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user