diff --git a/chirpstack/src/gateway/backend/mqtt.rs b/chirpstack/src/gateway/backend/mqtt.rs index 542bf1ca..37a5de9b 100644 --- a/chirpstack/src/gateway/backend/mqtt.rs +++ b/chirpstack/src/gateway/backend/mqtt.rs @@ -1,4 +1,5 @@ use std::io::Cursor; +use std::time::Duration; use anyhow::{Context, Result}; use async_trait::async_trait; @@ -93,6 +94,7 @@ impl<'a> MqttBackend<'a> { // connection options let mut conn_opts_b = mqtt::ConnectOptionsBuilder::new(); + conn_opts_b.automatic_reconnect(Duration::from_secs(1), Duration::from_secs(30)); conn_opts_b.clean_session(conf.clean_session); conn_opts_b.user_name(&conf.username); conn_opts_b.password(&conf.password); diff --git a/chirpstack/src/integration/mqtt.rs b/chirpstack/src/integration/mqtt.rs index a89279b0..6ae7084d 100644 --- a/chirpstack/src/integration/mqtt.rs +++ b/chirpstack/src/integration/mqtt.rs @@ -1,5 +1,6 @@ use std::collections::HashMap; use std::io::Cursor; +use std::time::Duration; use anyhow::{Context, Result}; use async_trait::async_trait; @@ -66,6 +67,7 @@ impl<'a> Integration<'a> { // connection options let mut conn_opts_b = mqtt::ConnectOptionsBuilder::new(); + conn_opts_b.automatic_reconnect(Duration::from_secs(1), Duration::from_secs(30)); conn_opts_b.clean_session(conf.clean_session); conn_opts_b.user_name(&conf.username); conn_opts_b.password(&conf.password);