monoh_ monoh_ - 3 months ago 224
ASP.NET (C#) Question

SignalR with ASP.NET Core doesnt use websockets but long polling

I have just done simple test with ASP.NET Core and SignalR(I used this version - 0.1.0-rtm-21431 - - guess it's the latest version .NET Core supports but when I'm wrong correct me) and noticed that it's using long polling(i sniffed http requests using Charles).

I did the same test for ASP.NET 4.6.1 with SignalR 2.2.1 - and it uses WebSockets fine.

I noticed that with long polling my test application is clearly slower, sometimes there are differences between clients.

Any idea why SignalR for AspNetCore doesnt use WebSockets but long polling instead? Is that my configuration mistake or maybe SignalR for .NET Core doesn't support websockets yet?


In order to use websockets you need to enable Register the websockets middleware first.

From official SignalR sample:

    public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)



Though websockets are not supported on any OS (Win8 or higher required or Windows Server 2012 or 2008 R2 and higher), so they still may fall back to long polling.