Set socketUser data from frontend
This commit is contained in:
parent
5b44117681
commit
9a262da13d
|
@ -19,11 +19,12 @@ export default class FrontendManager {
|
||||||
socket.on('SocketFrameEvent', this.onSocketFrame.bind(this, socket));
|
socket.on('SocketFrameEvent', this.onSocketFrame.bind(this, socket));
|
||||||
}
|
}
|
||||||
|
|
||||||
onSocketConnect(frontendConnection, socketID, socketIP) {
|
onSocketConnect(frontendConnection, socketID, socketIP, socketUser) {
|
||||||
const mapKey = frontendConnection.endpoint;
|
const mapKey = frontendConnection.endpoint;
|
||||||
const proxiedSocket = new ProxiedSocket(
|
const proxiedSocket = new ProxiedSocket(
|
||||||
socketID,
|
socketID,
|
||||||
socketIP,
|
socketIP,
|
||||||
|
socketUser,
|
||||||
this.socketEmitter,
|
this.socketEmitter,
|
||||||
frontendConnection);
|
frontendConnection);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
export default class ProxiedSocket extends EventEmitter {
|
export default class ProxiedSocket extends EventEmitter {
|
||||||
constructor(socketID, socketIP, socketEmitter, frontendConnection) {
|
constructor(socketID, socketIP, socketUser, socketEmitter, frontendConnection) {
|
||||||
super();
|
super();
|
||||||
this.id = socketID;
|
this.id = socketID;
|
||||||
this.ip = socketIP;
|
this.ip = socketIP;
|
||||||
this._realip = socketIP;
|
this._realip = socketIP;
|
||||||
|
if (socketUser) {
|
||||||
|
this.user = {
|
||||||
|
name: socketUser.name,
|
||||||
|
global_rank: socketUser.globalRank
|
||||||
|
};
|
||||||
|
}
|
||||||
this.socketEmitter = socketEmitter;
|
this.socketEmitter = socketEmitter;
|
||||||
this.frontendConnection = frontendConnection;
|
this.frontendConnection = frontendConnection;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue