public override async Task OnConnectedAsync() { string targetedHub = Context.GetHttpContext().Request.Query["hub"]; if (string.IsNullOrEmpty(targetedHub)) { Context.Abort(); return; } string userId = Context.User.Claims.FirstOrDefault(x => x.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value; mappingService.AddConnection(Context.ConnectionId, targetedHub, userId); await base.OnConnectedAsync(); }