public ChatSession Login(string username, IMessageHandler handler) { var session = new ChatSession(this, username, handler); lock (session) { _sessions.AddLast(session); } this.PostMessage("SERVER", $"{username} entered the chat"); return(session); }
public void Unregister(ChatSession session) { lock (_sessions) _sessions.Remove(session); }
IChatSession IChatService.Login(string username, IMessageHandler handler) { _session = _svc.Login(username, handler); return(_session); }