mirror of
https://github.com/yawaflua/WebSockets.git
synced 2025-12-10 04:19:33 +02:00
Create project files
This commit is contained in:
25
yawaflua.WebSockets/ServiceBindings.cs
Normal file
25
yawaflua.WebSockets/ServiceBindings.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using yawaflua.WebSockets.Core;
|
||||
using yawaflua.WebSockets.Core.Middleware;
|
||||
using yawaflua.WebSockets.Models.Interfaces;
|
||||
|
||||
namespace yawaflua.WebSockets;
|
||||
|
||||
public static class ServiceBindings
|
||||
{
|
||||
public static IServiceCollection SettingUpWebSockets(this IServiceCollection isc)
|
||||
{
|
||||
isc.AddSingleton<WebSocketRouter>();
|
||||
isc.AddScoped<IWebSocketManager, WebSocketManager>();
|
||||
isc.AddSingleton<WebSocketMiddleware>();
|
||||
return isc;
|
||||
}
|
||||
|
||||
public static IApplicationBuilder ConnectWebSockets(this IApplicationBuilder iab)
|
||||
{
|
||||
iab.UseWebSockets();
|
||||
iab.UseMiddleware<WebSocketMiddleware>();
|
||||
return iab;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user