IOnlineClientManager.GetAllClients always returns zero
See original GitHub issue- Your Abp package version: 6.0.0
- Your base framework: .NET Framework
using Abp.Dependency;
using Abp.Notifications;
using Abp.RealTime;
using Abp.Runtime.Session;
using Abp.Web.SignalR.Hubs;
using Microsoft.AspNet.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Test.Web
{
public class ClientManager : Hub, ITransientDependency
{
private readonly IOnlineClientManager _onlineClientManager;
private readonly IHubContext _hubContext; // Test purposes only
public ClientManager(IOnlineClientManager onlineClientManager)
{
_onlineClientManager = onlineClientManager;
_hubContext = GlobalHost.ConnectionManager.GetHubContext<AbpCommonHub>();
}
public override async Task OnConnected()
{
await base.OnConnected().ConfigureAwait(false);
var client = new OnlineClient(Context.ConnectionId, "", 0, 0);
_onlineClientManager.Add(client);
}
public override async Task OnDisconnected(bool stopCalled)
{
await base.OnDisconnected(stopCalled).ConfigureAwait(false);
_onlineClientManager.Remove(Context.ConnectionId);
}
public List<IOnlineClient> GetOnlineUsers()
{
var allclients = _onlineClientManager.GetAllClients(); // Always returns 0!!!
return allclients.ToList();
}
}
}
Startup.cs --> app.MapSignalR(); is invoked Web module --> Dependency on typeof(AbpWebSignalRModule) is specified SignalR packages are installed and referenced + JS scripts are properly bundled
OnConnected / OnDisconnected are never invoked. GetOnlineUsers() always returns an empty list.
Do I have to register my ClientManager in any way to make it work?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
IOnlineClientManager.GetAllClients always returns zero
Edited: My fault. I tested in the wrong environment. I created pr which fixed the error. All reactions.
Read more >Dependency injection of IOnlineClientManager in Signal R ...
I am trying to inject IOnlineClientManager in my hub but it ... ... GetAllClients(); // Always returns 0 return Clients.Caller.
Read more >How to Set the Expiration time for an user logon? #3891
I am using IOnlineClientManager to get all clients and sent real time message to them, is that if the user is out of...
Read more >SignalR Integration document
ASP.NET Boilerplate provides the IOnlineClientManager to get information about online users (inject IOnlineClientManager and use the GetByUserIdOrNull, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, I have created a separate issue https://github.com/aspnetboilerplate/aspnetboilerplate/issues/6204
I found the issue, it was not on the back-end side.
I was referencing an old version of jquery.signalR in the script bundle. Fixing that reference solved all the problems. Closing this issue.
Thanks!