SES-77 #12
12
SessionCompanion/SessionCompanion/Hubs/SessionHub.cs
Normal file
12
SessionCompanion/SessionCompanion/Hubs/SessionHub.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SessionCompanion.Hubs
|
||||
{
|
||||
public class SessionHub : Hub
|
||||
{
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http.Connections;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.SpaServices.AngularCli;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -8,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SessionCompanion.Configurations;
|
||||
using SessionCompanion.Database;
|
||||
using SessionCompanion.Hubs;
|
||||
|
||||
namespace SessionCompanion
|
||||
{
|
||||
@ -29,7 +31,7 @@ namespace SessionCompanion
|
||||
options.UseSqlServer(
|
||||
Configuration.GetConnectionString("DefaultConnection")));
|
||||
services.AddRepositories();
|
||||
|
||||
services.AddSignalR();
|
||||
// In production, the Angular files will be served from this directory
|
||||
services.AddSpaStaticFiles(configuration =>
|
||||
{
|
||||
@ -70,6 +72,12 @@ namespace SessionCompanion
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller}/{action=Index}/{id?}");
|
||||
endpoints.MapHub<SessionHub>("/sessionhub", options =>
|
||||
{
|
||||
options.Transports =
|
||||
HttpTransportType.WebSockets |
|
||||
HttpTransportType.LongPolling;
|
||||
});
|
||||
});
|
||||
|
||||
app.UseSpa(spa =>
|
||||
|
Loading…
Reference in New Issue
Block a user