initial commit with all the stuff
This commit is contained in:
19
2B+Software/www/mqtt/test.html
Normal file
19
2B+Software/www/mqtt/test.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>test Ws mqtt.js</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="./browserMqtt.js"></script>
|
||||
<script>
|
||||
var client = mqtt.connect('ws://cb03-ls:1884') // you add a ws:// url here
|
||||
client.subscribe("mqtt/demo")
|
||||
|
||||
client.on("message", function (topic, payload) {
|
||||
alert([topic, payload].join(": "))
|
||||
client.end()
|
||||
})
|
||||
|
||||
client.publish("mqtt/demo", "hello world!")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user