public override Task OnConnected() { // We show all currently connected users var currentUsers = _connections.AllConnectedUsers(); foreach (var user in currentUsers) { if (user != _username) { Clients.Client(Context.ConnectionId).userConnected(user); } } _connections.Add(_username, Context.ConnectionId); // We inform all other users that current user has connected Clients.AllExcept(Context.ConnectionId).userConnected(_username); return(base.OnConnected()); }