From 63807747cd0be5b3d57a1fb0044d6434a7826e57 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Fri, 16 May 2025 14:21:33 -0600 Subject: [PATCH] Adding mqtt test code, temporarily --- mqtt-test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 mqtt-test.js diff --git a/mqtt-test.js b/mqtt-test.js new file mode 100644 index 0000000..a6f65a5 --- /dev/null +++ b/mqtt-test.js @@ -0,0 +1,16 @@ +const mqtt = require('mqtt') +const client = mqtt.connect('mqtt://mqtt.srv.jnf.me', { + clientId: 'pictureframe_' + Math.random().toString(16).substr(2, 8), + username: 'pictureframe', + password: 'pictureframe' +}) + +client.on('connect', () => { + client.subscribe('pictureframe/#', (err) => { + if (err) console.log(err) + }) +}) + +client.on('message', (topic, message) => { + console.log(topic + ' : ' + message.toString()) +})