You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
515 B

var MQTTAscoltatore = require('../').MQTTAscoltatore;
var ascoltatore = new MQTTAscoltatore({
mqtt: require("mqttjs"),
host: "127.0.0.1",
port: 1883
});
ascoltatore.on("ready", function() {
ascoltatore.subscribe("sink", function(topic, message) {
console.log(message);
});
ascoltatore.subscribe("a/*", function(topic, message) {
ascoltatore.publish("sink", topic + ": " + message);
});
ascoltatore.publish("a/g", "hello world");
ascoltatore.publish("a/f", "hello world");
});