mqtt单例测试

This commit is contained in:
liming 蔡
2026-07-20 15:14:26 +08:00
parent 40b0df237e
commit b0c47af030
3 changed files with 32 additions and 4 deletions
+16 -1
View File
@@ -1,4 +1,5 @@
using JY.Model.Excel;
using JY.Inspection.Common;
using JY.Model.Excel;
using JY.Utility;
using MetroFramework.Forms;
using System;
@@ -50,5 +51,19 @@ namespace JY.Inspection.Frm
MessageBox.Show(ex.ToString());
}
}
private async void btn_sendMQTTClient_Click(object sender, EventArgs e)
{
await MqttSingleton.Instance.InitializeAsync(
brokerHost: "127.0.0.1",
clientId: "EVE",
username: string.Empty,
password: string.Empty
);
string topic = "EVE/工厂编码/EQP/设备编码";
string payload = "测试数据";
await MqttSingleton.Instance.SendAsync(topic, payload);
}
}
}