Base solution for your next web application
Open Closed

Count of online users for each tenant #7664


User avatar
0
BobIngham created

I seem to remember a discussion about how to get the count of online users for each tenant using SignalR. Can anyone point me to the correct discussion? I have searched this forum and the github pages to no avail.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @bobingham

    You can use IOnlineClientManager interface and get a Tenant's online clients similar to https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/RealTime/OnlineClientManager.cs#L118

    You just need to use a similar query excluding c.UserId == user.UserId condition.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    BobIngham created

    Hi @ismcagdas, Here is my query for getting summary data for the client. If I iterate around the result how do I get the number of online clients for each tenant?

    public async Task<List<GetTenantSummaryDataForHostDashboard_Output>> GetTenantSummaryData(GetHostDashboardDataInput input)
    {
        var query = await _sQLRepository.GetTenantSummaryDataForHostDashboard(input.From, input.To, input.UserId, 0);
        var model = ObjectMapper.Map<List<GetTenantSummaryDataForHostDashboard_Output>>(query.ToList());
        return model;
    }
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    maliming created
    Support Team

    hi @bobingham

    By default, the Online client is stored in memory (InMemoryOnlineClientStore). Can only be aggregated in memory.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    Mitch created

    It would be useful to be able to control the number of concurrent users per login. This request from @bobingham is what I'm looking for too. https://github.com/aspnetzero/aspnet-zero-core/issues/1414

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    BobIngham created

    So we have no idea of how to get the count of online uses for each tenant? Is this an impossible request or is there something we can do to facilitate?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi @bobingham, if you need to retrieve online user count for each tenant in the list, you will need to loop through the list and call IOnlineClientManager.GetAllClients().Where(c => c.TenantId == eachTenantId).Count()

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)