aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-06-28 21:50:23 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-06-28 21:50:23 +0100
commit264ae5e425e3c6f90fbea88ad66852a0b5186428 (patch)
tree341b55c763bb7ba808191c47dba972d44da4fe17
parente825e6820389fab7c97ae3665155401124ab8ecf (diff)
run callback in a goroutinev0.0.4
-rw-r--r--catbus.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/catbus.go b/catbus.go
index a3eb115..68dee1b 100644
--- a/catbus.go
+++ b/catbus.go
@@ -106,7 +106,7 @@ func (c *client) Subscribe(topic string, f MessageHandler) error {
return c.mqtt.Subscribe(topic, atLeastOnce, func(_ mqtt.Client, msg mqtt.Message) {
c.storePayload(msg.Topic(), Retention(msg.Retained()), string(msg.Payload()))
- f(c, messageFromMQTTMessage(msg))
+ go f(c, messageFromMQTTMessage(msg))
}).Error()
}