瀏覽代碼

Update client test app

release/3.x.x
Christian Kratky 6 年之前
父節點
當前提交
e6de4d014e
共有 1 個文件被更改,包括 9 次插入16 次删除
  1. +9
    -16
      Tests/MQTTnet.TestApp.NetCore/ClientTest.cs

+ 9
- 16
Tests/MQTTnet.TestApp.NetCore/ClientTest.cs 查看文件

@@ -12,25 +12,18 @@ namespace MQTTnet.TestApp.NetCore
{
try
{
var options = new MqttClientOptions
MqttNetConsoleLogger.ForwardToConsole();

var factory = new MqttFactory();
var client = factory.CreateMqttClient();
var clientOptions = new MqttClientOptions
{
ClientId = "XYZ",
CleanSession = true,
ChannelOptions = new MqttClientTcpOptions
{
//Server = "localhost",
Server = "192.168.1.174"
},
//ChannelOptions = new MqttClientWebSocketOptions
//{
// Uri = "ws://localhost:59690/mqtt"
//}
Server = "localhost"
}
};

var factory = new MqttFactory();
var client = factory.CreateMqttClient();

client.ApplicationMessageReceived += (s, e) =>
{
Console.WriteLine("### RECEIVED APPLICATION MESSAGE ###");
@@ -57,7 +50,7 @@ namespace MQTTnet.TestApp.NetCore

try
{
await client.ConnectAsync(options);
await client.ConnectAsync(clientOptions);
}
catch
{
@@ -67,7 +60,7 @@ namespace MQTTnet.TestApp.NetCore

try
{
await client.ConnectAsync(options);
await client.ConnectAsync(clientOptions);
}
catch (Exception exception)
{


Loading…
取消
儲存