SignalR .Net Core Multiple Connection

465 views Asked by At

Hello I have application backend is .NET Core and frontend is Angular 2+. I have one page that two people can both chat and see report in charts. I want to connect chart data and chat to backend with signalR. I can connected chat application. But how can I also make connection for chart datas? If there is any idea i will be so happy.

1

There are 1 answers

0
Kiril1512 On BEST ANSWER

to add another hub, you just create the second hub class and add it on the startup like:

public override void Configure(IApplicationBuilder app, HostConfiguration hostConfiguration, ILogger<Startup> logger)
{
    base.Configure(app, hostConfiguration, logger);

    app.UseWebSockets();

    app.UseCors(CorsPolicy);

    app.UseSignalR(routes =>
    {
        routes.MapHub<ChatHub>("/chatHub");
        routes.MapHub<DataHub>("/dataHub");
    });
}