Set socketUser data from frontend

This commit is contained in:
calzoneman 2015-12-30 21:57:46 -08:00
parent 5b44117681
commit 9a262da13d
2 changed files with 9 additions and 2 deletions

View file

@ -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);

View file

@ -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;
}