Fix jwt-token
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
function initializeSocketHandlers(io) {
|
||||
io.on('connection', (socket) => {
|
||||
const clientIP = socket.handshake.address || socket.request.connection.remoteAddress || 'unknown';
|
||||
// Get real client IP from proxy headers (nginx forwarded headers)
|
||||
const clientIP = socket.handshake.headers['x-forwarded-for']?.split(',')[0]?.trim() ||
|
||||
socket.handshake.headers['x-real-ip'] ||
|
||||
socket.handshake.address ||
|
||||
socket.request.connection.remoteAddress ||
|
||||
'unknown';
|
||||
console.log(`Client connected: ${socket.id} from IP: ${clientIP}`);
|
||||
|
||||
// Join device-specific rooms for targeted updates
|
||||
|
||||
Reference in New Issue
Block a user