Skip to content

Commit

Permalink
docs(cli):update docs about ws and protobuf support
Browse files Browse the repository at this point in the history
  • Loading branch information
ni00 committed Jun 28, 2023
1 parent 73aab61 commit 90ac69c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
14 changes: 11 additions & 3 deletions cli/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ mqttx conn --help
| -k, --keepalive <SEC> | MQTT 的 Keep Alive,默认为 30 |
| -u, --username <USER> | 连接到 MQTT Broker 的用户名 |
| -P, --password <PASS> | 连接到 MQTT Broker 的密码 |
| -l, --protocol <PROTO> | 连接时的协议,mqtt 或 mqtts,默认为 mqtt |
| -l, --protocol <PROTO> | 连接时的协议,支持 mqtt、mqtts、ws、wss,默认为 mqtt |
| --path <PATH> | websocket 的路径,默认为 /mqtt |
| --key <PATH> | key 文件的路径 |
| --cert <PATH> | cert 文件的路径 |
| --ca | ca 证书的文件路径 |
Expand Down Expand Up @@ -235,7 +236,8 @@ mqttx sub --help
| -k, --keepalive <SEC> | MQTT 的 Keep Alive,默认为 30 |
| -u, --username <USER> | 连接到 MQTT Broker 的用户名 |
| -P, --password <PASS> | 连接到 MQTT Broker 的密码 |
| -l, --protocol <PROTO> | 连接时的协议,mqtt 或 mqtts,默认为 mqtt |
| -l, --protocol <PROTO> | 连接时的协议,支持 mqtt、mqtts、ws、wss,默认为 mqtt |
| --path <PATH> | websocket 的路径,默认为 /mqtt |
| -nl, --no_local | MQTT 5.0 订阅选项中的 no local 标识 |
| -rap, --retain-as-published | MQTT 5.0 订阅选项中的 retain as published 标识 |
| -rh, --retain-handling <0/1/2> | MQTT 5.0 订阅选项中的 retain handling 标识 |
Expand Down Expand Up @@ -271,6 +273,8 @@ mqttx sub --help
| --save \[PATH\] | 将参数保存到本地配置文件中,文件支持 json 和 yaml 格式,默认路径为 ./mqttx-cli-config.json |
| --config \[PATH\] | 从本地配置文件加载参数,文件支持 json 和 yaml 格式,默认路径为 ./mqttx-cli-config.json |
| --help | 展示 sub 命令的帮助信息 |
| -Pp, --protobuf-path <PATH> | 定义 Protocol Buffers(protobuf)消息格式的 .proto 文件路径 |
| -Pmn, --protobuf-message-name <NAME> | Protobuf 消息类型的名称(必须存在于 .proto 文件中) |

### 发布

Expand All @@ -293,7 +297,9 @@ mqttx pub --help
| -M, --multiline | 可以通过多行发布多条消息 |
| -u, --username <USER> | 连接到 MQTT Broker 的用户名 |
| -P, --password <PASS> | 连接到 MQTT Broker 的密码 |
| -l, --protocol <PROTO> | 连接时的协议,mqtt 或 mqtts,默认为 mqtt |
| -f, --format <TYPE> | 输入消息的格式类型,支持 base64、json 和 hex |
| -l, --protocol <PROTO> | 连接时的协议,支持 mqtt、mqtts、ws、wss,默认为 mqtt |
| --path <PATH> | websocket 的路径,默认为 /mqtt |
| --key <PATH> | key 文件的路径 |
| --cert <PATH> | cert 文件的路径 |
| --ca | ca 证书的文件路径 |
Expand Down Expand Up @@ -329,6 +335,8 @@ mqttx pub --help
| --save \[PATH\] | 将参数保存到本地配置文件中,文件支持 json 和 yaml 格式,默认路径为 ./mqttx-cli-config.json |
| --config \[PATH\] | 从本地配置文件加载参数,文件支持 json 和 yaml 格式,默认路径为 ./mqttx-cli-config.json |
| --help | 展示 pub 命令的帮助信息 |
| -Pp, --protobuf-path <PATH> | 定义 Protocol Buffers(protobuf)消息格式的 .proto 文件路径 |
| -Pmn, --protobuf-message-name <NAME> | Protobuf 消息类型的名称(必须存在于 .proto 文件中) |

### 性能测试

Expand Down
14 changes: 11 additions & 3 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ mqttx conn --help
| -k, --keepalive <SEC> | send a ping every SEC seconds (default: 30) |
| -u, --username <USER> | the username |
| -P, --password <PASS> | the password |
| -l, --protocol <PROTO> | the protocol to use, mqtt or mqtts (default: mqtt) |
| -l, --protocol <PROTO> | the protocol to use, mqtt, mqtts, ws, or wss (default: mqtt) |
| --path <PATH> | the path of websocket (default: /mqtt) |
| --key <PATH> | path to the key file |
| --cert <PATH> | path to the cert file |
| --ca <PATH> | path to the ca certificate |
Expand Down Expand Up @@ -232,7 +233,8 @@ mqttx sub --help
| -k, --keepalive <SEC> | send a ping every SEC seconds (default: 30) |
| -u, --username <USER> | the username |
| -P, --password <PASS> | the password |
| -l, --protocol <PROTO> | the protocol to use, mqtt or mqtts (default: mqtt) |
| -l, --protocol <PROTO> | the protocol to use, mqtt, mqtts, ws, or wss (default: mqtt) |
| --path <PATH> | the path of websocket (default: /mqtt) |
| -nl, --no_local | the no local MQTT 5.0 flag |
| -rap, --retain-as-published | the retain as published MQTT 5.0 flag |
| -rh, --retain-handling <0/1/2> | the retain handling MQTT 5.0 |
Expand Down Expand Up @@ -268,6 +270,8 @@ mqttx sub --help
| --save \[PATH\] | save the parameters to the local configuration file, which supports json and yaml format, default path is `./mqttx-cli-config.json` |
| --config \[PATH\] | load the parameters from the local configuration file, which supports json and yaml format, default path is `./mqttx-cli-config.json` |
| --help | display help for sub command |
| -Pp, --protobuf-path <PATH> | the path to the .proto file that defines the message format for Protocol Buffers (protobuf) |
| -Pmn, --protobuf-message-name <NAME> | the name of the protobuf message type (must exist in the .proto file) |

### Publish

Expand All @@ -290,7 +294,9 @@ mqttx pub --help
| -M, --multiline | read lines from stdin as multiple messages |
| -u, --username <USER> | the username |
| -P, --password <PASS> | the password |
| -l, --protocol <PROTO> | the protocol to use, mqtt or mqtts (default: mqtt) |
| -f, --format <TYPE> | the format type of the input message, support base64, json, hex |
| -l, --protocol <PROTO> | the protocol to use, mqtt, mqtts, ws, or wss (default: mqtt) |
| --path <PATH> | the path of websocket (default: /mqtt) |
| --key <PATH> | path to the key file |
| --cert <PATH> | path to the cert file |
| --ca | path to the ca certificate |
Expand Down Expand Up @@ -326,6 +332,8 @@ mqttx pub --help
| --save \[PATH\] | save the parameters to the local configuration file, which supports json and yaml format, default path is `./mqttx-cli-config.json` |
| --config \[PATH\] | load the parameters from the local configuration file, which supports json and yaml format, default path is `./mqttx-cli-config.json` |
| --help | display help for pub command |
| -Pp, --protobuf-path <PATH> | the path to the .proto file that defines the message format for Protocol Buffers (protobuf) |
| -Pmn, --protobuf-message-name <NAME> | the name of the protobuf message type (must exist in the .proto file) |

### Benchmark

Expand Down
36 changes: 24 additions & 12 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Commander {
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down Expand Up @@ -140,12 +140,13 @@ export class Commander {
.option('-V, --mqtt-version <5/3.1.1/3.1>', 'the MQTT version', parseMQTTVersion, 5)
.option('-h, --hostname <HOST>', 'the broker host', 'localhost')
.option('-p, --port <PORT>', 'the broker port', parseNumber)
.option('-f, --format <TYPE>', 'the format type of the input message, support base64, json, hex', parseFormat)
.option('-i, --client-id <ID>', 'the client id', getClientId())
.option('--no-clean', 'set the clean session flag to false', true)
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down Expand Up @@ -195,9 +196,14 @@ export class Commander {
'--config [PATH]',
'load the parameters from the local configuration file, which supports json and yaml format, default path is ./mqttx-cli-config.json',
)
.option('-Pp, --protobuf-path <PATH>', 'the .proto file that defines the message format of protobuf')
.option('-Pmn, --protobuf-message-name <NAME>', 'the name of the protobuf message type')
.option('-f, --format <TYPE>', 'the format type of the input message, support base64, json, hex', parseFormat)
.option(
'-Pp, --protobuf-path <PATH>',
'the path to the .proto file that defines the message format for Protocol Buffers (protobuf)',
)
.option(
'-Pmn, --protobuf-message-name <NAME>',
'the name of the protobuf message type (must exist in the .proto file)',
)
.allowUnknownOption(false)
.action(pub)

Expand Down Expand Up @@ -237,7 +243,7 @@ export class Commander {

.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down Expand Up @@ -287,8 +293,14 @@ export class Commander {
'--config [PATH]',
'load the parameters from the local configuration file, which supports json and yaml format, default path is ./mqttx-cli-config.json',
)
.option('-Pp, --protobuf-path <PATH>', 'the .proto file that defines the message format of protobuf')
.option('-Pmn, --protobuf-message-name <NAME>', 'the name of the protobuf message type')
.option(
'-Pp, --protobuf-path <PATH>',
'the path to the .proto file that defines the message format for Protocol Buffers (protobuf)',
)
.option(
'-Pmn, --protobuf-message-name <NAME>',
'the name of the protobuf message type (must exist in the .proto file)',
)
.allowUnknownOption(false)
.action(sub)

Expand All @@ -307,7 +319,7 @@ export class Commander {
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down Expand Up @@ -405,7 +417,7 @@ export class Commander {
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down Expand Up @@ -492,7 +504,7 @@ export class Commander {

.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down Expand Up @@ -592,7 +604,7 @@ export class Commander {
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts', parseProtocol, 'mqtt')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws, or wss', parseProtocol, 'mqtt')
.option('--path <PATH>', 'the path of websocket', '/mqtt')
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
Expand Down

0 comments on commit 90ac69c

Please sign in to comment.