Real-Time Web Interface to MQTT using Socket.io and Node.js
Real-Time Web Interface to MQTT using Socket.io and Node.js First, all credit for this tutorial goes to Robert Hekkers Blog . I've altered it slightly to pick up newer versions of the various javascript libraries. If you've followed along with my earlier post , you now have MQTT running on your Raspberry Pi, and an Arduino IoT client that can publish and subscribe to MQTT packets. The next step is developing a real-time web interface that can control your MQTT network. Why Socket.io and Node.js? Web browsers typically operate by pulling data from a server when you click on a link. Servers don't usually keep an open connection to the browsers it has serviced, so if some event happens on the server side, the server cannot push that event to your browser, unless you refresh the page. That's where Socket.io comes in handy. Socket.io maintains an open connection between the server and the browser, which enables the server to push updates to the bro...
Comments
Post a Comment