Hi,
I am implamanting SignalR Hub. I am injecting IAbpSession as you described in documentation. Problem is that its not injected, only nullinstance is retrieved. On the other hand Logger works as expected. I am using abp version 0.8.4.
public class PrintDigitalHub : Hub, ITransientDependency
{
public ILogger Logger { get; set; }
public IAbpSession AbpSession { get; set; }
private readonly IOnlineClientManager _onlineClientManager;
public PrintDigitalHub(IOnlineClientManager onlineClientManager, IIocResolver iocResolver)
{
_onlineClientManager = onlineClientManager;
Logger = NullLogger.Instance;
AbpSession = NullAbpSession.Instance;
}
public async override Task OnConnected()
{
await base.OnConnected();
var client = new OnlineClient(
Context.ConnectionId,
GetIpAddressOfClient(),
AbpSession.TenantId,
AbpSession.UserId
);
Logger.Debug("A client is connected: " + client);
_onlineClientManager.Add(client);
}
Thanks for your help.
4 Answer(s)
-
0
After upgrade everything works, probably some old refrence caused this issue.
-
0
I have the same problem.
Update references not solve it to me.
-
0
Can you inject it in your constructor?
-
0
Testing inside a signalR Hub class.
Using NullAbpSession: {Abp.Runtime.Session.NullAbpSession} ImpersonatorTenantId: null ImpersonatorUserId: null MultiTenancySide: Tenant TenantId: null UserId: null
Injecting AbpSession in constructor (UserId still null): {Abp.Runtime.Session.IdentityFrameworkClaimsAbpSession} ImpersonatorTenantId: 1 ImpersonatorUserId: null MultiTenancySide: Tenant TenantId: 1 UserId: null
Thanks