aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--catbus.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/catbus.go b/catbus.go
index 2a3a120..66cab2e 100644
--- a/catbus.go
+++ b/catbus.go
@@ -82,14 +82,14 @@ func NewClient(brokerURI string, options ClientOptions) Client {
client.startAllTimers()
if options.ConnectHandler != nil {
- options.ConnectHandler(client)
+ go options.ConnectHandler(client)
}
})
mqttOpts.SetConnectionLostHandler(func(_ mqtt.Client, err error) {
client.stopAllTimers()
if options.DisconnectHandler != nil {
- options.DisconnectHandler(client, err)
+ go options.DisconnectHandler(client, err)
}
})
client.mqtt = mqtt.NewClient(mqttOpts)