Files
WebSockets/yawaflua.WebSockets/ServiceBindings.cs
Dmitri Shimanski abab2be4f4 Create project files
2025-03-29 02:34:08 +03:00

25 lines
751 B
C#

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;
}
}