从MQTT获得“有效载荷”以获取sails.js吗?

时间:2019-10-27 11:01:49

标签: javascript sails.js

在订阅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                    
            });

0 个答案:

没有答案