import MQTT from '../src/mqtt' import pause from 'delay' const BROKER='nas.kebler.net' let client = new MQTT({id:'example-mqtt-client', client:true, connect:{host:BROKER}}) ; (async () => { client.on('pushed', (packet) => {console.log('pushed packet came\n', packet)}) console.log(await client.connect()) await client.subscribe('test') await pause(2000) // give time for server to start first console.log('direct reply', await client.send({cmd:'test', msg:'this came from another mqtt client via broker'})) })().catch(err => { console.error('FATAL: UNABLE TO START SYSTEM!\n',err) })