this code is just for demonstration purposes.
require RAbbitMQ message broker. you need to activate the rabbitmq_mqtt_web plugin or any endpoint or server that can handle MQTT over web sockets. make sure to serve the index.html over HTTP and not over FTP.
git clone https://github.com/samyouaret/mqtt_over_sockets_example.git