This commit is contained in:
parent
96179d3225
commit
3b9cbe5ef2
@ -36,6 +36,7 @@ fun Application.module(testing: Boolean = false) {
|
||||
connOpts.password = appConfig.property("ktor.mq.password").getString().toCharArray()
|
||||
mqttClient.connect(connOpts)
|
||||
message.qos = 0
|
||||
mqttClient.publish("benchmark/startup", message)
|
||||
}
|
||||
|
||||
environment.monitor.subscribe(ApplicationStopped){
|
||||
@ -52,6 +53,7 @@ fun Application.module(testing: Boolean = false) {
|
||||
when (part) {
|
||||
is PartData.FormItem -> {
|
||||
if (part.name == "description") {
|
||||
println("Sending MQTT Message")
|
||||
val msgObj: MessageObject = gson.fromJson(part.value,MessageObject::class.java)
|
||||
mqttClient.publish("command/${msgObj.device_id}", message)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user