diff --git a/main.go b/main.go index d39428b..807bea3 100644 --- a/main.go +++ b/main.go @@ -84,7 +84,8 @@ func main() { mqtt.Setup(env) mqtt.Connect() - go mqtt.Listen() + go mqtt.Listen("/ATB/#") + go mqtt.Listen("ATB/#") http.HandleFunc("/devices", env.DevicesIndex) go http.ListenAndServe(":3000", nil) diff --git a/mqtt/mqtt.go b/mqtt/mqtt.go index f4fe238..d215bb4 100644 --- a/mqtt/mqtt.go +++ b/mqtt/mqtt.go @@ -40,7 +40,7 @@ func Connect() { fmt.Println("connected to broker, topic = ", topic) } -func Listen() { +func Listen(topic string) { if !client.IsConnected() { log.Fatal("Client is not connected") return @@ -82,8 +82,6 @@ func Setup(environment *env.Env) { //fmt.Println("customer: ", *customer) //fmt.Println("device: ", *device) - topic = "/ATB/#" - opts = createClientOptions(ev.Config.BrokerClientID, uri) }