public static void AddMinerStudioSession(WsUserName wsUserName, UserData userData, IPEndPoint remoteEndPoint, IWsSessionAdapter session) { IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, remoteEndPoint, session.SessionId, WsServer.MinerStudioWsSessions); MinerStudioSessionSet.Add(minerSession); session.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.ServerTime) { Data = Timestamp.GetTimestamp() }.SignToBytes(userData.Password)); }
protected override void OnOpen() { base.OnOpen(); if (!this.TryGetUser(out WsUserName wsUserName, out UserData userData)) { this.CloseAsync(); return; } IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, this.ID); WsRoot.MinerStudioSessionSet.Add(minerSession); }
public static void AddMinerStudioSession(IWsSessionAdapter session) { if (!WsRoot.TryGetUser(session.AuthorizationBase64, out WsUserName wsUserName, out UserData userData, out string errMsg)) { session.CloseAsync(WsCloseCode.Normal, errMsg); return; } IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, session.SessionId, WsRoot.WsServer.MinerStudioWsSessionsAdapter); WsRoot.MinerStudioSessionSet.Add(minerSession); session.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.ServerTime) { Data = Timestamp.GetTimestamp() }.SignToBytes(userData.Password)); }
protected override void OnOpen() { base.OnOpen(); if (!this.TryGetUser(out WsUserName wsUserName, out UserData userData)) { this.CloseAsync(); return; } IMinerStudioSession minerSession = MinerStudioSession.Create(userData, wsUserName, this.ID, Sessions); WsRoot.MinerStudioSessionSet.Add(minerSession); base.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.ServerTime) { Data = Timestamp.GetTimestamp() }.SignToBytes(userData.Password), completed: null); }