public Boolean notifyUser(String userName, String message)
        {
            String hash = HashArchive.getInstance().getHashByUserName(userName);

            if (hash != null)
            {
                WebSocketController.sendMessageToClient(hash, message);
                return(true);
            }
            LinkedList <String> CurrentPendingMessages;

            WebSocketController.PendingMessages.TryGetValue(userName, out CurrentPendingMessages);
            if (CurrentPendingMessages != null)
            {
                PMDB.Add(new Tuple <string, string>(userName, message));
                CurrentPendingMessages.AddLast(message);
            }
            else
            {
                PMDB.Add(new Tuple <string, string>(userName, message));
                CurrentPendingMessages = new LinkedList <String>();
                CurrentPendingMessages.AddLast(message);
                WebSocketController.PendingMessages.Add(userName, CurrentPendingMessages);
            }
            return(false);
        }
示例#2
0
 public static HashArchive getInstance()
 {
     if (instance == null)
     {
         instance = new HashArchive();
     }
     return(instance);
 }
示例#3
0
 public static void restartInstance()
 {
     instance = new HashArchive();
 }