Browse Source

Decode incoming messages as JSON

master
Starbeamrainbowlabs 2 years ago
parent
commit
321b154105
  1. 1
      .gitignore
  2. 11
      server/ttn-app-server/TTNAppServer.mjs

1
.gitignore

@ -1,3 +1,4 @@
*.pcapng
*.png
*.stl
config.custom.h

11
server/ttn-app-server/TTNAppServer.mjs

@ -56,7 +56,16 @@ class TTNAppServer {
}
async handle_message(topic, message_buffer) {
console.log(arguments);
let message = message_buffer.toString("utf8"),
message_object = null;
try {
message_object = JSON.parse(message);
} catch(error) {
this.log.log(error);
return false;
}
this.log.log(`[mqtt/handler] ${topic}: `, message_object);
// await this.message_handler.handle(payload);
}
}

Loading…
Cancel
Save