@conduitvc/mosca
Version:
MQTT broker as a module
19 lines (15 loc) • 351 B
HTML
<html>
<head>
<script src="/mqtt.js"></script>
</head>
<body>
<script>
var client = mqtt.connect();
client.subscribe("mqtt/demo");
client.on("message", function(topic, payload) {
alert([topic, payload].join(": "));
});
client.publish("mqtt/demo", "hello world!");
</script>
</body>
</html>