We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a486ef5 commit c17b7ceCopy full SHA for c17b7ce
buses/mqtt/mqtt.go
@@ -31,6 +31,7 @@ func (mqtt *Bus) Initialize(config config.MqttConfig) {
31
32
mqttOpts.OnConnect = func(client MQTT.Client) {
33
fmt.Printf("MQTT: CONNECTED TO %s\n", config.Server)
34
+ mqtt.SendMessage(config.TopicRoot+"/alarmserver", `{ "status": "up" }`)
35
}
36
37
mqttOpts.SetConnectionLostHandler(func(client MQTT.Client, err error) {
@@ -50,8 +51,6 @@ func (mqtt *Bus) Initialize(config config.MqttConfig) {
50
51
if token := mqtt.client.Connect(); token.Wait() && token.Error() != nil {
52
panic(token.Error())
53
-
54
- mqtt.SendMessage(config.TopicRoot+"/alarmserver", `{ "status": "up" }`)
55
56
57
func (mqtt *Bus) SendMessage(topic string, payload interface{}) {
0 commit comments