mirror of https://github.com/calzoneman/sync.git
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));
|
||||
}
|
||||
|
||||
onSocketConnect(frontendConnection, socketID, socketIP) {
|
||||
onSocketConnect(frontendConnection, socketID, socketIP, socketUser) {
|
||||
const mapKey = frontendConnection.endpoint;
|
||||
const proxiedSocket = new ProxiedSocket(
|
||||
socketID,
|
||||
socketIP,
|
||||
socketUser,
|
||||
this.socketEmitter,
|
||||
frontendConnection);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue