corrige temperature
This commit is contained in:
18
test_mqtt.rs
Normal file
18
test_mqtt.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use rumqttc::{AsyncClient, MqttOptions, QoS};
|
||||
use tokio::time::{timeout, Duration};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let mut mqttoptions = MqttOptions::new("test_client", "10.0.0.3", 1883);
|
||||
mqttoptions.set_keep_alive(Duration::from_secs(60));
|
||||
|
||||
let (client, mut eventloop) = AsyncClient::new(mqttoptions, 10);
|
||||
|
||||
println!("Trying to connect to MQTT broker...");
|
||||
|
||||
match timeout(Duration::from_secs(10), eventloop.poll()).await {
|
||||
Ok(Ok(event)) => println!("Connected! Event: {:?}", event),
|
||||
Ok(Err(e)) => println!("Connection error: {:?}", e),
|
||||
Err(_) => println!("Timeout waiting for connection"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user