mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-18 15:54:31 +01:00
@@ -30,12 +30,21 @@ pub fn make_client(
|
|||||||
username: Some(username),
|
username: Some(username),
|
||||||
password: Some(password),
|
password: Some(password),
|
||||||
// FIXME - mqtts
|
// FIXME - mqtts
|
||||||
// crt_bundle_attach: Some(esp_idf_sys::esp_crt_bundle_attach),
|
crt_bundle_attach: Some(esp_idf_sys::esp_crt_bundle_attach),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let b = format!("mqtt://{}", broker);
|
let mut mqtturl = broker.to_string();
|
||||||
let (client, mut connection) = EspMqttClient::new_with_conn(b, &conf)?;
|
if !(mqtturl.starts_with("mqtt://") || mqtturl.starts_with("mqtts://")) {
|
||||||
|
let scheme = if mqtturl.contains("8883") {
|
||||||
|
"mqtts"
|
||||||
|
} else {
|
||||||
|
"mqtt"
|
||||||
|
};
|
||||||
|
mqtturl = format!("{}://{}", scheme, mqtturl);
|
||||||
|
}
|
||||||
|
info!("=> connect to MQTT at {}", mqtturl);
|
||||||
|
let (client, mut connection) = EspMqttClient::new_with_conn(&mqtturl, &conf)?;
|
||||||
// let cc = EspMqttClient::new_with_conn(b, &conf)?;
|
// let cc = EspMqttClient::new_with_conn(b, &conf)?;
|
||||||
|
|
||||||
info!("MQTT client started");
|
info!("MQTT client started");
|
||||||
|
|||||||
Reference in New Issue
Block a user