Exemple #1
0
 public void SendAsync(WsMessage message, string password)
 {
     if (TryGetWsSession(out IWebSocketSession wsSession))
     {
         if (WsUserName.IsBinarySupported)
         {
             wsSession.Context.WebSocket.SendAsync(message.SignToBytes(password), completed: null);
         }
         else
         {
             wsSession.Context.WebSocket.SendAsync(message.SignToJson(password), completed: null);
         }
     }
 }
Exemple #2
0
 public void SendAsync(WsMessage message, string password)
 {
     if (TryGetWsSession(out IWsSessionAdapter wsSession))
     {
         if (WsUserName.IsBinarySupported)
         {
             wsSession.SendAsync(message.SignToBytes(password));
         }
         else
         {
             wsSession.SendAsync(message.SignToJson(password));
         }
     }
 }
 public void SendAsync(WsMessage message)
 {
     if (TryGetWsSession(out IWsSessionAdapter wsSession))
     {
         if (WsUserName.IsBinarySupported)
         {
             wsSession.SendAsync(message.SignToBytes(this.GetSignPassword()));
         }
         else
         {
             wsSession.SendAsync(message.SignToJson(this.GetSignPassword()));
         }
     }
 }
Exemple #4
0
 public void SendToMinerClientAsync(Guid clientId, WsMessage message)
 {
     if (TryGetByClientId(clientId, out IMinerClientSession minerClientSession))
     {
         if (TryGetWsSessions(out WebSocketSessionManager wsSessionManager))
         {
             string password = minerClientSession.GetSignPassword();
             try {
                 wsSessionManager.SendToAsync(message.SignToJson(password), minerClientSession.WsSessionId, completed: null);
             }
             catch {
             }
         }
     }
 }
Exemple #5
0
        public void SendToMinerStudioAsync(string loginName, WsMessage message)
        {
            List <IMinerStudioSession> minerStudioSessions = GetSessionsByLoginName(loginName);

            if (TryGetWsSessions(out WebSocketSessionManager wsSessionManager))
            {
                foreach (var minerStudioSession in minerStudioSessions)
                {
                    var userData = WsRoot.ReadOnlyUserSet.GetUser(UserId.CreateLoginNameUserId(minerStudioSession.LoginName));
                    if (userData != null)
                    {
                        try {
                            wsSessionManager.SendToAsync(message.SignToJson(userData.Password), minerStudioSession.WsSessionId, completed: null);
                        }
                        catch {
                        }
                    }
                }
            }
        }