Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SignalR 2 in ASP.NET 5 application

SignalR 3 and ASP.NET 5 were working together nicely up until the beta7 version. Now Microsoft states that SignalR 3 is 'on hold', and one should not expect the two to work together in the near future:

https://github.com/aspnet/SignalR-Server/issues/119

https://github.com/aspnet/SignalR-Server/issues/121

So the question: is there a way to make at least SignalR 2 work in an ASP.NET 5 app?

like image 418
Márton Balassa Avatar asked Oct 01 '15 14:10

Márton Balassa


People also ask

What SignalR 2?

SignalR is a technology used to create real-time functionality to applications. The term real-time is the ability to get the content to the clients instantly from the server. It doesn't wait for the client to request the data. This can add any kind of 'real-time' web functionality to your Asp.Net application.

What is SignalR in ASP NET MVC?

In webgrid of Asp.Net MVC when we perform Crud operations the signalR shows the task the record using the Id entered , updated or deleted. It just shows like system task manager. There are two sides -- One is Server Side and another one is Client Side.


1 Answers

Found the general solution for using owin-compatible middleware in this article: https://lbadri.wordpress.com/2014/11/01/asp-net-vnext-middleware-versus-owinkatana-middleware/

  1. Reference the Microsoft.AspNet.Owin package
  2. Insert the following code into Startup.Configure:
app.UseOwin(addToPipeline =>
{
    addToPipeline(next =>
    {
        var appBuilder = new AppBuilder();
        appBuilder.Properties["builder.DefaultApp"] = next;

        appBuilder.MapSignalR();

        return appBuilder.Build<AppFunc>();
    });
});
like image 157
Márton Balassa Avatar answered Oct 02 '22 07:10

Márton Balassa