diff options
Diffstat (limited to 'mqtt.go')
| -rw-r--r-- | mqtt.go | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -15,6 +15,7 @@ const ( RETAINED = true MQTT_CONNECT_TIMEOUT = 1 * time.Second MQTT_DISCONNECT_TIMEOUT_US = 500 + MQTT_KEEPALIVE_PERIOD = 2 * time.Second ) type MQTTMessage struct { @@ -32,6 +33,7 @@ func MQTTRun(tx chan MQTTMessage) { opts.SetAutoReconnect(true) opts.SetConnectRetry(true) opts.SetConnectTimeout(MQTT_CONNECT_TIMEOUT) + opts.SetKeepAlive(MQTT_KEEPALIVE_PERIOD) client := mqtt.NewClient(opts) |
