mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-17 09:43:05 +08:00
Improve internal server connection management. (#1232)
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MQTTnet.Client.Receiving;
|
||||
using MQTTnet.Diagnostics;
|
||||
using MQTTnet.Protocol;
|
||||
using MQTTnet.Server;
|
||||
using MQTTnet.Server.Internal;
|
||||
|
||||
namespace MQTTnet.TestApp.NetCore
|
||||
{
|
||||
@@ -13,6 +15,19 @@ namespace MQTTnet.TestApp.NetCore
|
||||
{
|
||||
var mqttServer = new MqttFactory().CreateMqttServer();
|
||||
mqttServer.StartAsync(new MqttServerOptions()).GetAwaiter().GetResult();
|
||||
|
||||
Console.WriteLine("Press any key to exit.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
public static void RunEmptyServerWithLogging()
|
||||
{
|
||||
var logger = new MqttNetLogger();
|
||||
MqttNetConsoleLogger.ForwardToConsole(logger);
|
||||
|
||||
var mqttFactory = new MqttFactory(logger);
|
||||
var mqttServer = mqttFactory.CreateMqttServer();
|
||||
mqttServer.StartAsync(new MqttServerOptions()).GetAwaiter().GetResult();
|
||||
|
||||
Console.WriteLine("Press any key to exit.");
|
||||
Console.ReadLine();
|
||||
|
||||
Reference in New Issue
Block a user