Web browsers use the http protocol and modern ones can also use websockets. However web browsers don’t have MQTT support built in. To publish and subscribe to an MQTT broker with a browser you will need to use a JavaScript MQTT over websockets client. See the MQTT over websockets if you’re not familiar with MQTT over websockets. This client enables you to create web Apps that use the MQTT protocol for displaying and sending data. In this tutorial I will take you through a example script that publishes messages and subscribes to topics using MQTT and websockets.
Continue reading