Guest User

Untitled

a guest
Apr 15th, 2018
227
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.min.js" type="text/javascript"></script>
  6. <script type="text/javascript">
  7. var mqtt;
  8. var reconnectTimeout = 2000;
  9. // var host = "m13.cloudmqtt.com";
  10. // var port =33942;
  11. var host = "iot.eclipse.org";
  12. var port =443;
  13.  
  14. function onConnect(){
  15. console.log("Connected");
  16. message = new Paho.MQTT.Message("hello world");
  17. message.destinationName = "esp/test";
  18. mqtt.send(message);
  19. }
  20. function MQTTconnect(){
  21. console.log("connecting to "+host+" "+port);
  22. mqtt = new Paho.MQTT.Client(host,port,"clientjs");
  23. var options = {
  24. timeout: 3,
  25. onSuccess: onConnect,
  26. //userName: "cnukrvlx",
  27. //password: ""
  28. };
  29. mqtt.connect(options);
  30. }
  31. </script>
  32. </head>
  33. <body>
  34. <h1>BODY</h1>
  35. <script type="text/javascript">
  36. MQTTconnect();
  37. </script>
  38.  
  39. </body>
  40. </html>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×