Adding mqtt test code, temporarily

This commit is contained in:
Jason Williams
2025-05-16 14:21:33 -06:00
parent aede9477c1
commit 63807747cd

16
mqtt-test.js Normal file
View File

@@ -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())
})