在订阅MQTT BROKER中的主题后,我遇到一个有关SAILS_HOOKS_MQTT的问题。
//PUBLISH TOPIC OR TOPICS(`array of topics`)
sails.hooks.mqtt.publish("hello i have just publish!!!",function(err){
if(err){
sails.log.error(new Error(err));
}
sails.log.debug('Message published successfully');
});
//SUBSCRIBE TOPIC OR TOPICS(`array of topics`)
sails.hooks.mqtt.subscribe('Test1',function(err, granted){
if(err){
sails.log.error(new Error(err));
}
sails.log.debug('Topic subscribe successfully');
sails.hooks.mqtt
});