public override async Task OnConnectedAsync() { RemotelyUser = DataService.GetUserByID(Context.UserIdentifier); if (await IsConnectionValid() == false) { return; } ConnectionIdToUserLookup.AddOrUpdate(Context.ConnectionId, RemotelyUser, (id, ru) => RemotelyUser); await Clients.Caller.SendAsync("UserOptions", RemotelyUser.UserOptions); await base.OnConnectedAsync(); }
public override async Task OnDisconnectedAsync(Exception exception) { ConnectionIdToUserLookup.Remove(Context.ConnectionId, out _); await base.OnDisconnectedAsync(exception); }