diff --git a/Core/Services/NotificationService.cs b/Core/Services/NotificationService.cs index 2ba21dae..b436bbf2 100644 --- a/Core/Services/NotificationService.cs +++ b/Core/Services/NotificationService.cs @@ -1,4 +1,4 @@ -using Core.Annotations; +using Core.Annotations; using Core.Models.Eft.Ws; namespace Core.Services; @@ -6,6 +6,8 @@ namespace Core.Services; [Injectable(InjectionType.Singleton)] public class NotificationService { + protected Dictionary> _messageQueue = new(); + public Dictionary> GetMessageQueue() { throw new NotImplementedException(); @@ -16,20 +18,20 @@ public class NotificationService throw new NotImplementedException(); } - public void UpdateMessageOnQueue(string sessionId, List value) + public void UpdateMessageOnQueue(string sessionId, List value) { throw new NotImplementedException(); } public bool Has(string sessionID) { - throw new NotImplementedException(); + return _messageQueue.ContainsKey(sessionID); } /// /// Pop first message from queue. /// - public object Pop(string sessionID) + public WsNotificationEvent Pop(string sessionID) { throw new NotImplementedException(); } @@ -39,15 +41,25 @@ public class NotificationService /// public void Add(string sessionID, WsNotificationEvent message) { - throw new NotImplementedException(); + Get(sessionID).Add(message); } /// /// Get message queue for session /// /// - public List Get(string sessionID) + public List Get(string sessionID) { - throw new NotImplementedException(); + if (sessionID is null) + { + throw new Exception("sessionID missing"); + } + + if (!_messageQueue.ContainsKey(sessionID)) + { + _messageQueue[sessionID] = []; + } + + return _messageQueue[sessionID]; } }