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); }
public static HashArchive getInstance() { if (instance == null) { instance = new HashArchive(); } return(instance); }
public static void restartInstance() { instance = new HashArchive(); }