Simple NodeJs App with MQTT

What is MQTT? MQTT is a lightweight, publish-subscribe network protocol that transports messages between devices. The protocol usually runs over TCP/IP, however, any network protocol that provides ordered, lossless, bi-directional connections can support MQTT. MQTT is used for data exchange between constrained devices and server applications . It keeps bandwidth requirements to an absolute minimum, handles unreliable networks, requires little implementation effort for developers, and is, therefore, ideal for machine-to-machine (M2M) communication. Node JS Application using MQTT Create a publish file. (pub.js) const mqtt = require ( 'mqtt' ); const client = mqtt . connect ( 'mqtt://broker.hivemq.com' ); client . on ( 'connect' , function (){ setInterval (() => { const random = Math . random () * 50 ; console . log ( random ) if ( random > 26 ){ ...