How do I get all logged in users? I want to display the name of all logged in users on the page. If users logged out and or new users logged in the list should refresh. I will use the SignalR but I want the events where I can get the logged in or logged out event of users.
-
ABP Framework version: v5.2.1
-
UI type: Angular
-
DB provider: EF Core
-
Tiered (MVC) or Identity Server Separated (Angular): yes
-
Exception message and stack trace:
-
Steps to reproduce the issue:"
2 Answer(s)
-
0
Hi,
I don't know what the logged-in users mean.
From your description, it sounds like a user who is using the application.
Just a suggestion:
You can use the SianglR and store the user information at the
OnConnectedAsync
event.public class ActiveHub:... { private readonly ICurrentUser _currentUser; ...... public override async Task OnConnectedAsync() { await AddActiveUserToCache(); return base.OnConnectedAsync(); } public async Task AddActiveUserAsync() { var userId = _currentUser....; ..... } public override async Task OnDisconnectedAsync(Exception exception) { await RemoveActiveUserAsync(); return base.OnDisconnectedAsync(exception); } public async Task RemoveActiveUserAsync() { .... } }
-
0
BTW, we have
SecurityLog
feature, logs are logged when a user logs in or out, it may helpful for you.