public void Handle(Join cmd) { var firstTimeJoined = members.Add(cmd.User); if (firstTimeJoined) Send(cmd.User, string.Format("{1} joined the room {0} ...", Id, cmd.User)); IObserverCollection connections; if (!online.TryGetValue(cmd.User, out connections)) { connections = new ObserverCollection(); online.Add(cmd.User, connections); } connections.Add(cmd.Client); }
public void Handle(Join cmd) { var firstTimeJoined = members.Add(cmd.User); if (firstTimeJoined) { Send(cmd.User, string.Format("{1} joined the room {0} ...", Id, cmd.User)); } IObserverCollection connections; if (!online.TryGetValue(cmd.User, out connections)) { connections = new ObserverCollection(); online.Add(cmd.User, connections); } connections.Add(cmd.Client); }
Task On(Join x) => Send(x.Room, $"{Id} joined the room {x.Room} ...");