diff --git a/README.md b/README.md index 0ed50c3..1c104ab 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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}" ``` @@ -56,7 +57,8 @@ 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 @@ -64,11 +66,14 @@ Flags: 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 @@ -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, ...) ``` diff --git a/command-sub.go b/command-sub.go index 76528ea..e21bcf9 100644 --- a/command-sub.go +++ b/command-sub.go @@ -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) { diff --git a/command-subret.go b/command-subret.go index 0aa42ee..3d33795 100644 --- a/command-subret.go +++ b/command-subret.go @@ -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")