Our web client imports the Paho-MQTT JavaScript client library at line (1):
<title>MQTT Web Socket Example</title>
<script src="./jquery.min.js"></script>
<script src="./paho-mqtt.js"></script> <!-- (1) -->
paho-mqtt.js can be also found in the chapter04/mosquitto_www folder.
The official documentation page for the Paho-MQTT JavaScript library is available at https://www.eclipse.org/paho/clients/js, while its official GitHub page is found at https://github.com/eclipse/paho.mqtt.javascript.
When you explore the Paho-MQTT JavaScript API further, start at its GitHub site and make note of any breaking changes that are mentioned. The documentation pages are known to contain code fragments that do not reflect the latest GitHub code base.
Next, we encounter the global variables.