I am trying to use SignalR with aspnetcore 2.0.0 preview. The preview version is supposed to have support for signalR as per the release notes and I can add references to the "Microsoft.aspnetcoreSignalR" package.
However, I am unable to find the MapSignalR
extension method or something like useSignalR()
on the IApplicationBuilder.
Googling around for this gives lots of examples of the UseAppBuilder
extension method. However, I still get stuck at MapSignalR
with the below code:
using Microsoft.AspNetCore.Builder;
using Microsoft.Owin.Mapping;
using Microsoft.Owin.Helpers;
using Microsoft.Owin.Extensions;
using Microsoft.Owin.Builder;
using Owin;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MyNamespace
{
using AppFunc = Func<IDictionary<string, object>, Task>;
public static class SignalRExtensions
{
public static IApplicationBuilder UseAppBuilder(this IApplicationBuilder app, Action<IAppBuilder> configure)
{
app.UseOwin(addToPipeline =>
{
addToPipeline(next =>
{
var appBuilder = new AppBuilder();
appBuilder.Properties["builder.DefaultApp"] = next;
configure(appBuilder);
return appBuilder.Build<AppFunc>();
});
});
return app;
}
public static void UseSignalR2(this IApplicationBuilder app)
{
app.UseAppBuilder(appBuilder => appBuilder.MapSignalR());
}
}
}
This is unable to find the MapSignalR
extension method. Any thoughts on if I can find this some nuget package that will work with aspnetcore? Or is there a different mechanism to initialize signalR with aspnetcore 2.0.0 preview?
I am using visual studio 2017 preview 15.3 with .Net core 2.0 preview installed.