# -*- coding: utf-8 -*- #!/usr/bin/env python def test_topic_command(): """ var mqtt = require('mqtt'); var client = mqtt.connect('mqtt://test.mosquitto.org'); client.on('connect', function () { //订阅presence主题 client.subscribe('presence'); //向presence主题发布消息 client.publish('presence', 'Hello mqtt'); }); client.on('message', function (topic, message) { //收到的消息是一个Buffer console.log(message.toString()); client.end(); }); :return: """ from apps.dispatch.commands import TopicCommand tc = TopicCommand(cmdNo=201, devNo='test1', params=[], prefix='diag')