0
votes

I am trying to Send a message to a particular User using Azure SignalR like this

await this.hubContext.Clients.User(UserId).SendAsync("NotifyUser", "message");

According to https://docs.microsoft.com/en-us/aspnet/core/signalr/groups?view=aspnetcore-3.0 By default Signalr uses ClaimTypes.NameIdentifier to identify the user.

Can I change this default setting to use ClaimTypes.EmailClaim instead? Is this Configurable?

1

1 Answers

0
votes

For .NetCore app. This approach works

public class CustomUserIdentityProvider : IUserIdProvider
        {
        public string GetUserId(HubConnectionContext connection)
        {
            return connection.User.Claims.FirstOrDefault(x => x.Type == Constants.EmailClaim)?.Value;
        }
    }