如何测试Mosquitto服务器? [英] How to test the `Mosquitto` server?

查看:298
本文介绍了如何测试Mosquitto服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MosquittoMQTT的新手,我下载了Mosquitto服务器库,但不知道如何对其进行测试.

I am new to Mosquitto and MQTT, I downloaded the Mosquitto server library but I do not know how to test it.

有什么方法可以测试Mosquitto服务器?

Is there any way to test the Mosquitto server?

推荐答案

在单独的终端窗口中执行以下操作:

In separate terminal windows do the following:

  1. 启动代理:

  1. Start the broker:

mosquitto

  • 启动命令行订户:

  • Start the command line subscriber:

    mosquitto_sub -v -t 'test/topic'
    

  • 使用命令行发布者发布测试消息:

  • Publish test message with the command line publisher:

    mosquitto_pub -t 'test/topic' -m 'helloWorld'
    

  • 除了在经纪人终端中看到订户和发布者连接消息外,还应在订户终端中打印以下内容:

    As well as seeing both the subscriber and publisher connection messages in the broker terminal the following should be printed in the subscriber terminal:

    test/topic helloWorld
    

    这篇关于如何测试Mosquitto服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆