public override Task OnDisconnected(bool stopCalled) { UsersDictionary.Remove(Context.ConnectionId); Clients.All.updateUserNamesList(UsersDictionary.Select(p => new { value = p.Value }).ToList()); return(base.OnDisconnected(stopCalled)); }
public void RegisterUser(string name) { if (UsersDictionary.ContainsKey(Context.ConnectionId)) { return; } UsersDictionary.Add(Context.ConnectionId, name); Clients.All.updateUserNamesList(UsersDictionary.Select(p => new { value = p.Value }).ToList()); }