How to use generic hub in SignalR
I've found the answer. The MSDN documentation is not up-to-date as of yet, but the ASP .NET site offers nice SignalR tutorials and one of them covers the typed hubs:
http://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-server#stronglytypedhubs
As the example in the article shows, if you use an interface for the type argument, everything works and you get strongly-typed hub clients whose methods are correctly translated to RPCs. Here's a piece of code I tested this with:
public sealed class TestHub : Hub<ITestClient>{ public override Task OnConnected() { this.Clients.Caller.SayHello("Hello from OnConnected!"); return base.OnConnected(); } public void Hi() { // Say hello back to the client when client greets the server. this.Clients.Caller.SayHello("Well, hello there!"); }}public interface ITestClient{ void SayHello(String greeting);}