【发布时间】:2021-11-20 10:44:19
【问题描述】:
我有 Blazor WebAssembly 客户端应用和带有 Microsoft Identity 的 ASPCore WebAPI,我想从服务器向特定用户发送通知。
我对如何实现这一点的第一个想法是发送这样的通知:
public async System.Threading.Tasks.Task SendPushNotification(ClaimsPrincipal user, string someNotificationMessage)
{
string userGuid = user.FindFirst(ClaimTypes.NameIdentifier).Value;
await _hubContext.Clients.All.SendAsync("notification", userGuid, someNotificationMessage);
}
在客户端检查身份,但我什至还没弄清楚如何在 blazor 客户端上获取身份。?
但我认为肯定有更好的方法。请告诉我如何向特定用户发送通知?
【问题讨论】:
标签: c# asp.net-core signalr blazor-webassembly