uci-mqtt/examples/client.js

15 lines
414 B
JavaScript
Raw Normal View History

import MQTT from '../src/mqtt'
// import btc from 'better-try-catch'
const HOST='nas.kebler.net'
let client = new MQTT({id:'example-mqtt-client', topics:'', connect:{hostname:HOST}})
;
(async () => {
// mqtt.registerPacketProcessor(logit)
console.log(await client.connect())
client.send({cmd:'lights/on', id:'someidofalight'})
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})