From 5601c78a9ff23392cfbcc62f231fcfa4e0eeb309 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 27 Jun 2025 17:01:59 +0100 Subject: Minimal changes to convert to async --- src/config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 1190b9a..0f9cff3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, fs, path::Path, process, time::Duration}; -use rumqttc::{Client, Connection, MqttOptions}; +use rumqttc::{AsyncClient, EventLoop, MqttOptions}; use serde::Deserialize; use crate::PROGRAM; @@ -41,7 +41,7 @@ pub struct Config { } impl Config { - pub fn mqtt_client(&self) -> (Client, Connection) { + pub fn mqtt_client(&self) -> (AsyncClient, EventLoop) { let client_id = format!("{}_{}", self.id, process::id()); let mut options = MqttOptions::new(client_id, &self.host, self.port); if let Some(credentials) = &self.credentials { @@ -49,7 +49,7 @@ impl Config { } options.set_keep_alive(Duration::from_secs(5)); options.set_max_packet_size(10 * 1024 * 1024, 10 * 1024 * 1024); - Client::new(options, 10) + AsyncClient::new(options, 10) } } -- cgit v1.2.3-70-g09d2