手表通讯完毕
This commit is contained in:
@@ -112,6 +112,15 @@ builder.Services.Configure<ApiBehaviorOptions>((o) =>
|
||||
{
|
||||
o.SuppressModelStateInvalidFilter = true;
|
||||
});
|
||||
// 注册 SocketGatewayServer 为 Singleton(单例,整个应用生命周期一个实例)
|
||||
builder.Services.AddSingleton<SocketGatewayServer>(provider =>
|
||||
{
|
||||
var server = new SocketGatewayServer("192.168.50.163", 4021); // 你可以按需修改 IP 和端口
|
||||
server.Start(); // 项目启动时立即启动监听
|
||||
//server.StartReceiving();
|
||||
|
||||
return server;
|
||||
});
|
||||
var app = builder.Build();
|
||||
InternalApp.ServiceProvider = app.Services;
|
||||
InternalApp.Configuration = builder.Configuration;
|
||||
|
||||
Reference in New Issue
Block a user