From 9a262da13d5a782615c73fac8747c486e219a86a Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 30 Dec 2015 21:57:46 -0800 Subject: [PATCH] Set socketUser data from frontend --- src/io/backend/frontendmanager.js | 3 ++- src/io/backend/proxiedsocket.js | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/io/backend/frontendmanager.js b/src/io/backend/frontendmanager.js index 730fb321..b04f7d34 100644 --- a/src/io/backend/frontendmanager.js +++ b/src/io/backend/frontendmanager.js @@ -19,11 +19,12 @@ export default class FrontendManager { socket.on('SocketFrameEvent', this.onSocketFrame.bind(this, socket)); } - onSocketConnect(frontendConnection, socketID, socketIP) { + onSocketConnect(frontendConnection, socketID, socketIP, socketUser) { const mapKey = frontendConnection.endpoint; const proxiedSocket = new ProxiedSocket( socketID, socketIP, + socketUser, this.socketEmitter, frontendConnection); diff --git a/src/io/backend/proxiedsocket.js b/src/io/backend/proxiedsocket.js index 49e034c2..67202b3e 100644 --- a/src/io/backend/proxiedsocket.js +++ b/src/io/backend/proxiedsocket.js @@ -1,11 +1,17 @@ import { EventEmitter } from 'events'; export default class ProxiedSocket extends EventEmitter { - constructor(socketID, socketIP, socketEmitter, frontendConnection) { + constructor(socketID, socketIP, socketUser, socketEmitter, frontendConnection) { super(); this.id = socketID; this.ip = socketIP; this._realip = socketIP; + if (socketUser) { + this.user = { + name: socketUser.name, + global_rank: socketUser.globalRank + }; + } this.socketEmitter = socketEmitter; this.frontendConnection = frontendConnection; }