diff options
author | Ethel Morgan <eth@ethulhu.co.uk> | 2020-06-30 15:38:57 +0100 |
---|---|---|
committer | Ethel Morgan <eth@ethulhu.co.uk> | 2020-06-30 15:38:57 +0100 |
commit | 5d0003e5a36359afa21d6509de330b9fa2e81d70 (patch) | |
tree | 80bd548eaa9938a20f33d89d50bdc1523ba325f2 /catbus.go | |
parent | e3be5b2a39a1e2b04adc1468f379e7f69aada669 (diff) |
run ConnectHandler and DisconnectHandler in goroutines
Diffstat (limited to 'catbus.go')
-rw-r--r-- | catbus.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |