From 759891c01e9739a637902a2bc70322d9279ab66e Mon Sep 17 00:00:00 2001 From: Maddin-619 Date: Mon, 29 Apr 2024 16:11:04 +0200 Subject: [PATCH] fix: reuse session to receive data from subscriptions after reconnect --- pkg/mqtt/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/mqtt/client.go b/pkg/mqtt/client.go index 1f15278..b18bdfb 100644 --- a/pkg/mqtt/client.go +++ b/pkg/mqtt/client.go @@ -47,6 +47,7 @@ func NewClient(o Options) (Client, error) { opts.SetPingTimeout(60 * time.Second) opts.SetKeepAlive(60 * time.Second) opts.SetAutoReconnect(true) + opts.SetCleanSession(false) opts.SetMaxReconnectInterval(10 * time.Second) opts.SetConnectionLostHandler(func(c paho.Client, err error) { log.DefaultLogger.Error("MQTT Connection lost", "error", err)