Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Feb 26, 2024
1 parent b03919d commit f8a1625
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Common flags:
--id string MQTT client ID (default "mqtt-test-bssJjZUs1vhTvf6KpTpTLw")
-q, --quiet Quiet mode, only print results
-s, --server stringArray MQTT endpoint as username:password@host:port (default [tcp://localhost:1883])
--timeout duration Timeout for the test (default 10s)
--version version for mqtt-test
-v, --very-verbose Very verbose, print everything we can
```
Expand All @@ -40,7 +41,7 @@ Flags:
--retain Mark each published message as retained
--size int Approximate size of each message (pub adds a timestamp)
--timestamp Prepend a timestamp to each message
--topic string Base topic (prefix) to publish into (/{n} will be added if --topics > 0) (default "mqtt-test/fIqfOq5Lg5wk636V4sLXoc")
--topic string Base topic (prefix) to publish into (/{n} will be added if --topics > 0)
--topics int Cycle through NTopics appending "/{n}"
```

Expand All @@ -56,19 +57,23 @@ Flags:
--repeat int Subscribe, receive retained messages, and unsubscribe N times (default 1)
--retained int Expect to receive this many retained messages
--subscribers int Number of subscribers to run concurrently (default 1)
--topic string Base topic for the test, will subscribe to {topic}/+
--timestamp Expect a timestamp in the payload and use it to calculate receive time
--topic string Topic to subscribe to
```

##### pubsub

Publishes N messages, and waits for all of them to be received by subscribers. Measures end-end delivery time on the messages. Used with `--num-subscribers` can run several concurrent subscriber connections.

```
--messages int Number of messages to publish and receive (default 1)
--qos int MQTT QOS
--size int Approximate size of each message (pub adds a timestamp)
--subscribers int Number of subscribers to run concurrently (default 1)
--topic string Topic to publish and subscribe to (default "mqtt-test/JPrbNU6U3IbVQLIyazkP4y")
--messages int Number of messages to publish and receive (default 1)
--mps int Publish mps messages per second; 0 means no delay (default 1000)
--pub-server string Server to publish to. Defaults to the first server in --servers
--qos int MQTT QOS
--size int Message extra payload size (in addition to the JSON timestamp)
--subscribers int Number of subscribers to run concurrently (default 1)
--topic string Topic (or base topic if --topics > 1)
--topics int Number of topics to use, If more than one will add /1, /2, ... to --topic when publishing, and subscribe to topic/+ (default 1)
```

##### subret
Expand All @@ -78,10 +83,12 @@ topics N times. Measures time to SUBACK and to all retained messages received.
Used with `--subscribers` can run several concurrent subscriber connections.

```
--qos int MQTT QOS
--repeat int Subscribe, receive retained messages, and unsubscribe N times (default 1)
--size int Approximate size of each message (pub adds a timestamp)
--subscribers int Number of subscribers to run concurrently (default 1)
--topic string Base topic (prefix) for the test (default "mqtt-test/yNkmAFnFHETSGnQJNjwGdN")
--topics int Number of sub-topics to publish retained messages to (default 1)
--mps int Publish mps messages per second; 0 means no delay (default 1000)
--pub-server stringArray Server(s) to publish to. Defaults to --servers
--qos int MQTT QOS for subscriptions. Messages are published as QOS1.
--repeat int Subscribe, receive retained messages, and unsubscribe N times (default 1)
--retained int Number of retained messages to publish and receive (default 1)
--size int Message payload size
--subscribers int Number of subscribers to run concurrently (default 1)
--topic string base topic (if --retaned > 1 will be published to topic/1, topic/2, ...)
```
4 changes: 2 additions & 2 deletions command-sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func newSubCommand() *cobra.Command {
cmd.Flags().IntVar(&c.opts.expectRetained, "retained", 0, `Expect to receive this many retained messages`)
cmd.Flags().BoolVar(&c.opts.expectTimestamp, "timestamp", false, "Expect a timestamp in the payload and use it to calculate receive time")
cmd.Flags().IntVar(&c.opts.qos, "qos", DefaultQOS, "MQTT QOS")
cmd.Flags().IntVar(&c.opts.repeat, "repeat", 1, "Subscribe, receive retained messages, and unsubscribe N times")
cmd.Flags().StringVar(&c.opts.topic, "topic", defaultTopic(), "Base topic for the test, will subscribe to {topic}/+")
cmd.Flags().IntVar(&c.opts.repeat, "repeat", 1, "Subscribe, receive (retained) messages, and unsubscribe this many times")
cmd.Flags().StringVar(&c.opts.topic, "topic", defaultTopic(), "Topic to subscribe to")
cmd.Flags().IntVar(&c.subscribers, "subscribers", 1, `Number of subscribers to run concurrently`)

cmd.PreRun = func(_ *cobra.Command, _ []string) {
Expand Down
2 changes: 1 addition & 1 deletion command-subret.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newSubRetCommand() *cobra.Command {
cmd.Flags().IntVar(&c.pubOpts.messages, "retained", 1, "Number of retained messages to publish and receive")
cmd.Flags().IntVar(&c.pubOpts.mps, "mps", 1000, `Publish mps messages per second; 0 means no delay`)
cmd.Flags().IntVar(&c.pubOpts.size, "size", 0, "Message payload size")
cmd.Flags().StringVar(&c.pubOpts.topic, "topic", defaultTopic(), "base topic (retaned messages will be published to topic/1, topic/2, ...)")
cmd.Flags().StringVar(&c.pubOpts.topic, "topic", defaultTopic(), "base topic (if --retained > 1 will be published to topic/1, topic/2, ...)")

cmd.Flags().IntVar(&c.subOpts.qos, "qos", DefaultQOS, "MQTT QOS for subscriptions. Messages are published as QOS1.")
cmd.Flags().IntVar(&c.subOpts.repeat, "repeat", 1, "Subscribe, receive retained messages, and unsubscribe N times")
Expand Down

0 comments on commit f8a1625

Please sign in to comment.