using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Builder;
using SlnMesnac.Config;
using TouchSocket.Sockets;
namespace SlnMesnac.TouchSocket
{
///
/// 注册服务
///
public static class TouchSocketSetup
{
public static void AddTouchSocketSetup(this IServiceCollection services)
{
services.AddSingleton();//注册TouchSocket的服务
services.AddSingleton();
}
public static IApplicationBuilder UseTouchSocketExtensions(this IApplicationBuilder app)
{
var appConfig = app.ApplicationServices.GetService();
var _server = app.ApplicationServices.GetService();
_server.Init(appConfig.listernPort);
return app;
}
}
}