SignalR has a Hub class that looks like this:
public abstract class Hub<T> : Hub where T : class
{
protected Hub();
public IHubCallerClients<T> Clients { get; set; }
}
public interface IHubCallerClients : IHubCallerClients<IClientProxy>, IHubClients<IClientProxy>
Which uses a IClientProxy type so you can call interface methods instead of SendAsync()
on Clients. I want to do the same thing with the Serverless Hub
class which does not have a generic constructor so how could I accomplish this? I've tried just inheriting and hiding the base property like so:
public abstract class ServerlessHub<T> : ServerlessHub
where T : class
{
protected ServerlessHub(IServiceHubContext hubContext = null, IServiceManager serviceManager = null)
: base(hubContext, serviceManager)
{
}
public new IHubClients<T> Clients { get; }
}
but I get a null reference exception for Clients.