PHPMQTT-CLI —— PHPMQTT 命令行工具
PHPMQTT-CLI是基于PHPMQTT提供的命令行工具,支持发布和订阅。
____ _ _ ____ __ __ ___ _____ _____ | _ \| | | | _ \| \/ |/ _ \_ _|_ _| | |_) | |_| | |_) | |\/| | | | || | | | | __/| _ | __/| | | | |_| || | | | |_| |_| |_|_| |_| |_|\__\_\|_| |_|
安装
composer require simps/mqtt-cli
使用
Publish
$ php vendor/bin/mqtt publish --help Description: Publishing simple messages Usage: publish [options] Options: -H, --host[=HOST] Specify the host to connect to [default: "localhost"] -P, --port[=PORT] Connect to the port specified [default: 1883] -t, --topic=TOPIC The MQTT topic on which to publish the message -m, --message=MESSAGE Send a single message from the command line -i, --id[=ID] The id to use for this client [default: ""] --qos[=QOS] Specify the quality of service to use for the message, from 0, 1 and 2 [default: 0] --dup[=DUP] If the DUP flag is set to 0, it indicates that this is the first occasion that the Client or Server has attempted to send this PUBLISH packet [default: 0] -r, --retain[=RETAIN] If the RETAIN flag is set to 1 in a PUBLISH packet sent by a Client to a Server, the Server MUST replace any existing retained message for this topic and store the Application Message [default: 0] -u, --username[=USERNAME] Provide a username to be used for authenticating with the broker -p, --pw[=PW] Provide a password to be used for authenticating with the broker -c, --clean-session[=CLEAN-SESSION] Setting the 'clean session' flag [default: true] -l, --level=LEVEL MQTT Protocol level [default: 4] -k, --keepalive[=KEEPALIVE] The number of seconds between sending PING commands to the broker for the purposes of informing it we are still connected and functioning [default: 0] --will-topic[=WILL-TOPIC] The topic on which to send a Will, in the event that the client disconnects unexpectedly --will-message[=WILL-MESSAGE] Specify a message that will be stored by the broker and sent out if this client disconnects unexpectedly --will-qos[=WILL-QOS] The QoS to use for the Will [default: 0] --will-retain[=WILL-RETAIN] If given, if the client disconnects unexpectedly the message sent out will be treated as a retained message [default: 0] -S, --ssl[=SSL] Enable SSL encryption [default: false] --config-path[=CONFIG-PATH] Setting the Swoole config file path --properties-path[=PROPERTIES-PATH] Setting the Properties config file path -h, --help Display help for the given command. When no command is given display help for the list command -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Help: An MQTT version 3.1/3.1.1/5.0 client for publishing simple messages
Subscribe
$ php vendor/bin/mqtt subscribe --help Description: Subscribing to topics Usage: subscribe [options] Options: -H, --host[=HOST] Specify the host to connect to [default: "localhost"] -P, --port[=PORT] Connect to the port specified [default: 1883] -i, --id[=ID] The id to use for this client [default: ""] --qos=QOS Specify the quality of service to use for the message, from 0, 1 and 2 (multiple values allowed) -t, --topic=TOPIC The MQTT topic to subscribe to (multiple values allowed) -u, --username[=USERNAME] Provide a username to be used for authenticating with the broker -p, --pw[=PW] Provide a password to be used for authenticating with the broker -c, --clean-session[=CLEAN-SESSION] Setting the 'clean session' flag [default: true] -l, --level=LEVEL MQTT Protocol level [default: 4] -k, --keepalive[=KEEPALIVE] The number of seconds between sending PING commands to the broker for the purposes of informing it we are still connected and functioning [default: 0] --will-topic[=WILL-TOPIC] The topic on which to send a Will, in the event that the client disconnects unexpectedly --will-message[=WILL-MESSAGE] Specify a message that will be stored by the broker and sent out if this client disconnects unexpectedly --will-qos[=WILL-QOS] The QoS to use for the Will [default: 0] --will-retain[=WILL-RETAIN] If given, if the client disconnects unexpectedly the message sent out will be treated as a retained message [default: 0] -S, --ssl[=SSL] Enable SSL encryption [default: false] --config-path[=CONFIG-PATH] Setting the Swoole config file path --properties-path[=PROPERTIES-PATH] Setting the Properties config file path -U, --unsubscribe[=UNSUBSCRIBE] Topics that need to be unsubscribed (multiple values allowed) -e, --event[=EVENT] Subscribed EventDispatcher [default: ""] -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
每日一博 | 从抽象类开始,详解责任链模式
点击上方蓝字,关注并星标,和我一起学技术。 大家好,欢迎大家阅读周五的设计模式专题。 今天我们继续介绍新的设计模式,和上次的链式模式不同,这一次要介绍的责任链模式不仅仅在Python当中有,在很多其他的语言当中同样支持,比如Java。Python和Java当中的这个设计模式是完全一样的,没有任何区别。 和之前介绍的设计模式相比,今天介绍的设计模式同样不难。我们非常容易想明白它的原理。 责任链 在我们日常的开发当中,经常会有上下游的依赖,比如当前我们需要开发一份新的数据,需要用到上游的某一份老数据才能生成。这时候需要我们写一个接口,然后上游也随之改造,把它们的新数据写到我们这个接口来。 这就带来了一个问题,也就是上下游耦合的问题,如果下游有一天变动了,上游也需要随着变动。如果是一对一的可能还好,如果一个上游存在多个下游,那么这会是一件很麻烦的事。每一个下游变动了,上游都需要调整。举个最简单的例子,比如下游想要做一个AB测试,想要一半流量进入A机器,一半流量进入B机器。这都需要上游配合。 这当然是很不合理的,在实际当中上游的数据可能是另外一个团队负责的,他们只对数据质量负责,并不一定会愿意...
- 下一篇
微软宣布推出 WSL 对 Linux GUI 的初步支持
微软面向 Windows Insider 的 Dev 频道用户发布了一个 Windows 10 Build 21364 预览版更新。其中一项值得注意的更新内容为:Windows Subsystem for Linux(WSL)上使用首批对 GUI 应用的支持,可以直接在 Windows 上运行 Linux GUI应用。 在一年前的 Build 2020 大会上,WSL 团队曾表示,他们的目标是使用户能够在桌面上无缝地运行Windows 应用程序与 Linux GUI 应用程序。现在,微软则宣布 Windows 10 中的 WSL 已提供了对 GUI 应用程序的首个预览支持(微软将该功能命名为 WSLg)。 “这意味着,你现在可以运行自己喜欢的 GUI 编辑器、工具和应用程序来构建和测试 Linux 应用程序”。演示视频 微软方面介绍称,用户可以使用这个功能来运行任何可能只存在于 Linux 中的 GUI 应用程序,或者在 Linux 环境下运行自己的应用程序或进行测试。对于想要测试其跨平台应用程序的开发者而言,这可能非常有用。同时,WSL 上的 Linux GUI 应用程序还提供了开箱...
相关文章
文章评论
共有0条评论来说两句吧...