【问题标题】:Realtime retrieve online users, authenticated with Identity Blazor (Server / WebAssembly)实时检索在线用户,通过 Identity Blazor (Server / WebAssembly) 进行身份验证
【发布时间】:2021-09-16 20:26:06
【问题描述】:

我正在 Blazor(服务器/WebAssembly)中创建聊天,使用 SignalR 我平静地收到收到消息的通知。 如何查看在线用户是谁?

【问题讨论】:

    标签: server blazor identity webassembly


    【解决方案1】:

    使用信号器,您可以覆盖集线器 OnConnectedAsyncOnDisconnectedAsync

    public async override Task OnConnectedAsync()
    {
        await notificationsService.ConnectAsync(this.ToCallerContext());
        await base.OnConnectedAsync();
    }
    
    public async override Task OnDisconnectedAsync(Exception exception)
    {
        await notificationsService.DisconnectAsync(this.ToCallerContext());
        await base.OnDisconnectedAsync(exception);
    }
    

    【讨论】:

      猜你喜欢
      • 2019-03-26
      • 1970-01-01
      • 2020-11-02
      • 2022-01-21
      • 2020-09-16
      • 2020-07-23
      • 2021-09-20
      • 2020-06-08
      • 1970-01-01
      相关资源
      最近更新 更多