public WebServer(int port = 45411, int httpsPort = -1) : base(port, httpsPort) { if (!string.IsNullOrWhiteSpace(Program.settings.mqttHost) && Program.settings.mqttTcpPort > 0 && Program.settings.mqttTcpPort < 65536 && !string.IsNullOrWhiteSpace(Program.settings.mqttUser) && !string.IsNullOrWhiteSpace(Program.settings.mqttPass)) { mqttReader = new MqttReader(Program.settings.mqttHost, Program.settings.mqttTcpPort, Program.settings.mqttUser, Program.settings.mqttPass); _ = mqttReader.Start(); } }
private async void MQTT_Test_Load(object sender, EventArgs e1) { WriteLine("Connecting to " + Program.settings.mqttHost); reader = new MqttReader(Program.settings.mqttHost, Program.settings.mqttTcpPort, Program.settings.mqttUser, Program.settings.mqttPass); reader.OnError += Reader_OnError; reader.OnStatusUpdate += Reader_OnStatusUpdate; reader.OnDeviceUpdate += Reader_OnDeviceUpdate; await reader.Start(); }