File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const (
1818 PublishDelay = 3 * time .Second
1919 ConnectTimeout = 5 * time .Second
2020 ConnectRetryInterval = 3 * time .Second
21+ KeepAlive = 30
2122)
2223
2324type Config struct {
@@ -36,11 +37,11 @@ func Connect(cfg Config, logger *slog.Logger) *autopaho.ConnectionManager {
3637 }
3738
3839 conn , err := autopaho .NewConnection (context .Background (), autopaho.ClientConfig {
39- ServerUrls : []* url.URL {mqttURL },
40- KeepAlive : 30 ,
41- ConnectRetryDelay : ConnectRetryInterval ,
42- OnConnectionUp : func (cm * autopaho.ConnectionManager , _ * paho.Connack ) { logger .Info ("mqtt connection up" ) },
43- OnConnectError : func (err error ) { logger .Error ("error whilst attempting connection" , "error" , err ) },
40+ ServerUrls : []* url.URL {mqttURL },
41+ KeepAlive : KeepAlive ,
42+ ConnectRetryDelay : ConnectRetryInterval ,
43+ OnConnectionUp : func (_ * autopaho.ConnectionManager , _ * paho.Connack ) { logger .Info ("mqtt connection up" ) },
44+ OnConnectError : func (err error ) { logger .Error ("error whilst attempting connection" , "error" , err ) },
4445 ClientConfig : paho.ClientConfig {
4546 ClientID : cfg .ClientID ,
4647 },
You can’t perform that action at this time.
0 commit comments