From 0afbc1c508e9eca6408cc279fb20e08af4a9f1da Mon Sep 17 00:00:00 2001 From: Ollo Date: Sat, 13 Jan 2024 00:01:49 +0100 Subject: [PATCH] Mqtt subscribe works --- client/bin/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/bin/src/main.rs b/client/bin/src/main.rs index bbc845f..22500c6 100644 --- a/client/bin/src/main.rs +++ b/client/bin/src/main.rs @@ -1,5 +1,6 @@ use std::{time::Duration, fmt::format}; use std::sync::RwLock; +use openssl::string; use paho_mqtt; use str; use bit::BitIndex; @@ -387,6 +388,7 @@ fn main_function(ipaddress: String, mqtt: Option) -> ExitCode { return ExitCode::FAILURE; } let mut mqtt_client: Option = None; + let mut mqtt_message: Option = None; if mqtt.is_some() { let mqtt_ip: String = mqtt.clone().unwrap(); // Define the set of options for the create. @@ -427,7 +429,8 @@ fn main_function(ipaddress: String, mqtt: Option) -> ExitCode { let topic = msg.topic(); let payload_str = msg.payload_str(); - println!("MQTT | {} - {}", topic, payload_str); + //println!("MQTT | {} - {}", topic, payload_str); + mqtt_message = Some(payload_str.to_string()); } });