- fix re-connection after connection loss to broker
- add subscribe call after reconnect - additional config settings for timeout values - add more info/warn outputs - change default log level from "warn" to "info"
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
package MqttService
|
||||
|
||||
type MqttServiceConfig struct {
|
||||
BrokerAddress string `yaml:"broker-address"`
|
||||
TopicPrefix string `yaml:"topic-prefix"`
|
||||
AutoReconnect bool `yaml:"auto-reconnect"`
|
||||
ConnectTimeoutMs int `yaml:"connect-timeout-ms"`
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
|
||||
BrokerAddress string `yaml:"broker-address"`
|
||||
TopicPrefix string `yaml:"topic-prefix"`
|
||||
AutoReconnect bool `yaml:"auto-reconnect"`
|
||||
ConnectTimeoutMs int `yaml:"connect-timeout-ms"`
|
||||
ConnectRetryIntervalMs int `yaml:"connect-retry-interval-ms"`
|
||||
MaxReconnectIntervalMs int `yaml:"max-reconnect-interval-ms"`
|
||||
Username string `yaml:"username"`
|
||||
Password string `yaml:"password"`
|
||||
}
|
||||
|
||||
func NewMqttServiceConfig() MqttServiceConfig {
|
||||
return MqttServiceConfig{
|
||||
BrokerAddress: "tcp://localhost:1883",
|
||||
TopicPrefix: "/rpicontrol",
|
||||
AutoReconnect: true,
|
||||
ConnectTimeoutMs: 10000,
|
||||
|
||||
BrokerAddress: "tcp://localhost:1883",
|
||||
TopicPrefix: "/rpicontrol",
|
||||
AutoReconnect: true,
|
||||
ConnectTimeoutMs: 10000,
|
||||
ConnectRetryIntervalMs: 10000,
|
||||
MaxReconnectIntervalMs: 10000,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user