31 lines
888 B
C#
31 lines
888 B
C#
|
|
using LangGuan.Services;
|
|||
|
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace LangGuan.Command.Extension
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
public static class SocketExtension
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="services"></param>
|
|||
|
|
public static void AddSocketService(this IServiceCollection services)
|
|||
|
|
{
|
|||
|
|
// services.AddSingleton<MQTTService>();
|
|||
|
|
services.AddScoped<HJ212SocketServer>();
|
|||
|
|
services.AddScoped<PingService>();
|
|||
|
|
|
|||
|
|
IServiceProvider serviceProvider = services.BuildServiceProvider();
|
|||
|
|
_ = serviceProvider.GetService<HJ212SocketServer>().Start();
|
|||
|
|
serviceProvider.GetService<PingService>().CreatTask();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|