Testing WebSockets with the Eclipse Paho client JavaScript utility
We will use the Eclipse Paho client JavaScript utility to generate a simple MQTT over WebSockets client on a web browser. We will make this client subscribe to a topic and print all the messages it receives. Follow the next steps:
Open a web browser in the same computer in which you are running the Mosquitto server and navigate to http://www.ecli pse.org/paho/clients/js/utility .
Enter
localhost
in Host. Enter
9001
in Port.Make sure
/ws
is specified in Path.Make sure the TLS checkbox is unchecked. The following screenshot shows the web page with the appropriate values for the connection options:
Click Connect. The web page will display Connected to: localhost:9001/ws as, followed by the Client ID that was automatically generated.
Go to the Subscribe panel. Enter
home/control/leds/1
in Topic, below Subscribe.Select
2
in the QoS dropdown below Subscribe. The following screenshot shows the Subscribe panel with the appropriate...