mosquitto_rr.1.xml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <?xml-stylesheet type="text/xsl" href="manpage.xsl"?>
  3. <refentry xml:id="mosquitto_rr" xmlns:xlink="http://www.w3.org/1999/xlink">
  4. <refmeta>
  5. <refentrytitle>mosquitto_rr</refentrytitle>
  6. <manvolnum>1</manvolnum>
  7. <refmiscinfo class="source">Mosquitto Project</refmiscinfo>
  8. <refmiscinfo class="manual">Commands</refmiscinfo>
  9. </refmeta>
  10. <refnamediv>
  11. <refname>mosquitto_rr</refname>
  12. <refpurpose>an MQTT version 5/3.1.1 client for request/response messaging</refpurpose>
  13. </refnamediv>
  14. <refsynopsisdiv>
  15. <cmdsynopsis>
  16. <command>mosquitto_rr</command>
  17. <arg choice='plain'><option>-e</option> <replaceable>response-topic</replaceable></arg>
  18. <group choice='req'>
  19. <arg choice='plain'>
  20. <arg><option>-h</option> <replaceable>hostname</replaceable></arg>
  21. <arg><option>--unix</option> <replaceable>socket path</replaceable></arg>
  22. <arg><option>-p</option> <replaceable>port-number</replaceable></arg>
  23. <arg><option>-u</option> <replaceable>username</replaceable></arg>
  24. <arg><option>-P</option> <replaceable>password</replaceable></arg>
  25. <arg choice='plain' rep='repeat'><option>-t</option> <replaceable>message-topic</replaceable></arg>
  26. </arg>
  27. <arg choice='plain'>
  28. <arg choice='plain'><option>-L</option> <replaceable>URL</replaceable></arg>
  29. <arg choice='opt' rep='repeat'><option>-t</option> <replaceable>message-topic</replaceable></arg>
  30. </arg>
  31. </group>
  32. <group choice='req'>
  33. <arg choice='plain'><option>-f</option> <replaceable>file</replaceable></arg>
  34. <arg choice='plain'><option>-m</option> <replaceable>message</replaceable></arg>
  35. <arg choice='plain'><option>-n</option></arg>
  36. <arg choice='plain'><option>-s</option></arg>
  37. </group>
  38. <arg><option>-A</option> <replaceable>bind-address</replaceable></arg>
  39. <arg><option>-c</option></arg>
  40. <arg><option>-d</option></arg>
  41. <arg><option>-D</option> <replaceable>command</replaceable> <replaceable>identifier</replaceable> <replaceable>value</replaceable></arg>
  42. <arg><option>-i</option> <replaceable>client-id</replaceable></arg>
  43. <arg><option>-I</option> <replaceable>client-id-prefix</replaceable></arg>
  44. <arg><option>-k</option> <replaceable>keepalive-time</replaceable></arg>
  45. <arg><option>-N</option></arg>
  46. <arg><option>--nodelay</option></arg>
  47. <arg><option>--pretty</option></arg>
  48. <arg><option>-q</option> <replaceable>message-QoS</replaceable></arg>
  49. <arg><option>-R</option></arg>
  50. <arg><option>-S</option></arg>
  51. <arg><option>-v</option></arg>
  52. <arg><option>-V</option> <replaceable>protocol-version</replaceable></arg>
  53. <arg><option>-W</option> <replaceable>message-processing-timeout</replaceable></arg>
  54. <arg><option>-x</option> <replaceable>session-expiry-interval</replaceable></arg>
  55. <arg><option>--proxy</option> <replaceable>socks-url</replaceable></arg>
  56. <arg><option>--quiet</option></arg>
  57. <arg>
  58. <option>--will-topic</option> <replaceable>topic</replaceable>
  59. <arg><option>--will-payload</option> <replaceable>payload</replaceable></arg>
  60. <arg><option>--will-qos</option> <replaceable>qos</replaceable></arg>
  61. <arg><option>--will-retain</option></arg>
  62. </arg>
  63. <group>
  64. <arg>
  65. <group choice='req'>
  66. <arg choice='plain'><option>--cafile</option> <replaceable>file</replaceable></arg>
  67. <arg choice='plain'><option>--capath</option> <replaceable>dir</replaceable></arg>
  68. </group>
  69. <arg><option>--cert</option> <replaceable>file</replaceable></arg>
  70. <arg><option>--key</option> <replaceable>file</replaceable></arg>
  71. <arg><option>--ciphers</option> <replaceable>ciphers</replaceable></arg>
  72. <arg><option>--tls-version</option> <replaceable>version</replaceable></arg>
  73. <arg><option>--tls-alpn</option> <replaceable>protocol</replaceable></arg>
  74. <arg><option>--tls-engine</option> <replaceable>engine</replaceable></arg>
  75. <arg><option>--keyform</option>
  76. <group choice='req'>
  77. <arg choice='plain'><replaceable>pem</replaceable></arg>
  78. <arg choice='plain'><replaceable>engine</replaceable></arg>
  79. </group></arg>
  80. <arg><option>--tls-engine-kpass-sha1</option> <replaceable>kpass-sha1</replaceable></arg>
  81. <arg><option>--tls-use-os-certs</option></arg>
  82. <arg><option>--insecure</option></arg>
  83. </arg>
  84. <arg>
  85. <arg choice='plain'><option>--psk</option> <replaceable>hex-key</replaceable></arg>
  86. <arg choice='plain'><option>--psk-identity</option> <replaceable>identity</replaceable></arg>
  87. <arg><option>--ciphers</option> <replaceable>ciphers</replaceable></arg>
  88. <arg><option>--tls-version</option> <replaceable>version</replaceable></arg>
  89. </arg>
  90. </group>
  91. </cmdsynopsis>
  92. <cmdsynopsis>
  93. <command>mosquitto_rr</command>
  94. <group choice='plain'>
  95. <arg><option>--help</option></arg>
  96. </group>
  97. </cmdsynopsis>
  98. </refsynopsisdiv>
  99. <refsect1>
  100. <title>Description</title>
  101. <para><command>mosquitto_rr</command> is an MQTT version 5/3.1.1
  102. client that can be used to publish a request message and wait for a
  103. response. When using MQTT v5, which is the default,
  104. <command>mosquitto_rr</command> will use the Request-Response
  105. feature.</para>
  106. <para>The important options are <option>-t</option>, <option>-e</option>,
  107. and one of <option>-f</option>, <option>-m</option>, <option>-n</option>,
  108. and <option>-s</option>.</para>
  109. <para>Example: <code>mosquitto_rr -t request-topic -e response-topic -m message</code></para>
  110. </refsect1>
  111. <refsect1>
  112. <title>Encrypted Connections</title>
  113. <para><command>mosquitto_rr</command> supports TLS encrypted
  114. connections. It is strongly recommended that you use an encrypted
  115. connection for anything more than the most basic setup.</para>
  116. <para>To enable TLS connections when using x509 certificates, one of
  117. either <option>--cafile</option> or <option>--capath</option> can
  118. be provided as an option.</para>
  119. <para>Alternatively, if the <option>-p 8883</option> option is used
  120. then the OS provided certificates will be loaded and neither
  121. <option>--cafile</option> or <option>--capath</option> are
  122. needed</para>
  123. <para>To enable TLS connections when using TLS-PSK, you must use the
  124. <option>--psk</option> and the <option>--psk-identity</option>
  125. options.</para>
  126. </refsect1>
  127. <refsect1>
  128. <title>Options</title>
  129. <para>The options below may be given on the command line, but may also
  130. be placed in a config file located at
  131. <option>$XDG_CONFIG_HOME/mosquitto_rr</option> or
  132. <option>$HOME/.config/mosquitto_rr</option> with one pair of
  133. <option>-option <replaceable>value</replaceable></option>
  134. per line. The values in the config file will be used as defaults
  135. and can be overridden by using the command line. The exceptions to
  136. this is <option>-t</option>, which if given in the config file will
  137. not be overridden. Note also that currently some options cannot be
  138. negated, e.g. <option>-S</option>. Config file lines that have a
  139. <option>#</option> as the first character are treated as comments
  140. and not processed any further.</para>
  141. <variablelist>
  142. <varlistentry>
  143. <term><option>-A</option></term>
  144. <listitem>
  145. <para>Bind the outgoing connection to a local ip
  146. address/hostname. Use this argument if you need to
  147. restrict network communication to a particular
  148. interface.</para>
  149. </listitem>
  150. </varlistentry>
  151. <varlistentry>
  152. <term><option>-c</option></term>
  153. <term><option>--disable-clean-session</option></term>
  154. <listitem>
  155. <para>Disable 'clean session' / enable persistent client mode.
  156. When this argument is used, the broker will be instructed
  157. not to clean existing sessions for the same client id when
  158. the client connects, and sessions will never expire when
  159. the client disconnects. MQTT v5 clients can change their
  160. session expiry interval with the <option>-x</option> argument.
  161. </para>
  162. <para>When a session is persisted on the broker, the subscriptions
  163. for the client will be maintained after it disconnects, along
  164. with subsequent QoS 1 and QoS 2 messages that arrive. When the
  165. client reconnects and does not clean the session, it will
  166. receive all of the queued messages.</para>
  167. <para>If using this option, the client id must be set
  168. manually with <option>--id</option></para>
  169. </listitem>
  170. </varlistentry>
  171. <varlistentry>
  172. <term><option>--cafile</option></term>
  173. <listitem>
  174. <para>Define the path to a file containing PEM encoded CA
  175. certificates that are trusted. Used to enable SSL
  176. communication.</para>
  177. <para>See also <option>--capath</option></para>
  178. </listitem>
  179. </varlistentry>
  180. <varlistentry>
  181. <term><option>--capath</option></term>
  182. <listitem>
  183. <para>Define the path to a directory containing PEM encoded CA
  184. certificates that are trusted. Used to enable SSL
  185. communication.</para>
  186. <para>For <option>--capath</option> to work correctly, the
  187. certificate files must have ".crt" as the file ending
  188. and you must run "openssl rehash &lt;path to capath&gt;" each
  189. time you add/remove a certificate.</para>
  190. <para>See also <option>--cafile</option></para>
  191. </listitem>
  192. </varlistentry>
  193. <varlistentry>
  194. <term><option>--cert</option></term>
  195. <listitem>
  196. <para>Define the path to a file containing a PEM encoded
  197. certificate for this client, if required by the
  198. server.</para>
  199. <para>See also <option>--key</option>.</para>
  200. </listitem>
  201. </varlistentry>
  202. <varlistentry>
  203. <term><option>--ciphers</option></term>
  204. <listitem>
  205. <para>An openssl compatible list of TLS ciphers to support
  206. in the client. See
  207. <citerefentry><refentrytitle><link xlink:href="https://linux.die.net/man/1/ciphers">ciphers</link></refentrytitle><manvolnum>1</manvolnum></citerefentry>
  208. for more information.</para>
  209. </listitem>
  210. </varlistentry>
  211. <varlistentry>
  212. <term><option>-d</option></term>
  213. <term><option>--debug</option></term>
  214. <listitem>
  215. <para>Enable debug messages.</para>
  216. </listitem>
  217. </varlistentry>
  218. <varlistentry>
  219. <term><option>-D</option></term>
  220. <term><option>--property</option></term>
  221. <listitem>
  222. <para>Use an MQTT v5 property with this publish. If you use
  223. this option, the client will be set to be an MQTT v5
  224. client. This option has two forms:</para>
  225. <para><option>-D command identifier value</option></para>
  226. <para><option>-D command identifier name value</option></para>
  227. <para><option>command</option> is the MQTT command/packet
  228. identifier and can be one of CONNECT, PUBACK, PUBREC,
  229. PUBCOMP, SUBSCRIBE, UNSUBSCRIBE, DISCONNECT, AUTH, or
  230. WILL. The properties available for each command are
  231. listed in the Properties section.</para>
  232. <para><option>identifier</option> is the name of the
  233. property to add. This is as described in the
  234. specification, but with '-' as a word separator. For
  235. example:
  236. <option>payload-format-indicator</option>. More details
  237. are in the <link linkend='properties'>Properties</link>
  238. section.</para>
  239. <para><option>value</option> is the value of the property
  240. to add, with a data type that is property
  241. specific.</para>
  242. <para><option>name</option> is only used for the
  243. <option>user-property</option> property as the first of
  244. the two strings in the string pair. In that case,
  245. <option>value</option> is the second of the strings in
  246. the pair.</para>
  247. </listitem>
  248. </varlistentry>
  249. <varlistentry>
  250. <term><option>-e</option></term>
  251. <listitem>
  252. <para>Response topic. The client will subscribe to this topic to wait for a response.</para>
  253. </listitem>
  254. </varlistentry>
  255. <varlistentry>
  256. <term><option>-f</option></term>
  257. <term><option>--file</option></term>
  258. <listitem>
  259. <para>Send the contents of a file as the request message.</para>
  260. </listitem>
  261. </varlistentry>
  262. <varlistentry>
  263. <term><option>-F</option></term>
  264. <listitem>
  265. <para>Specify output printing format. This option allows
  266. you to choose what information from each message is
  267. printed to the screen. See the <link
  268. linkend='outputformat'>Output Format</link> section
  269. below for full details.</para>
  270. <para>This option overrides the <option>-v</option> option,
  271. but does not override the <option>-N</option>
  272. option.</para>
  273. </listitem>
  274. </varlistentry>
  275. <varlistentry>
  276. <term><option>--help</option></term>
  277. <listitem>
  278. <para>Display usage information.</para>
  279. </listitem>
  280. </varlistentry>
  281. <varlistentry>
  282. <term><option>-h</option></term>
  283. <term><option>--host</option></term>
  284. <listitem>
  285. <para>Specify the host to connect to. Defaults to localhost.</para>
  286. </listitem>
  287. </varlistentry>
  288. <varlistentry>
  289. <term><option>-i</option></term>
  290. <term><option>--id</option></term>
  291. <listitem>
  292. <para>The id to use for this client. If not given, a client id will
  293. be generated depending on the MQTT version being used. For v3.1.1/v3.1,
  294. the client generates a client id in the format
  295. <option>mosq-XXXXXXXXXXXXXXXXXX</option>, where the
  296. <option>X</option> are replaced with random alphanumeric
  297. characters. For v5.0, the client sends a zero length client id, and the
  298. server will generate a client id for the client.</para>
  299. <para>This option cannot be used at the same time as the
  300. <option>--id-prefix</option> argument.</para>
  301. </listitem>
  302. </varlistentry>
  303. <varlistentry>
  304. <term><option>-I</option></term>
  305. <term><option>--id-prefix</option></term>
  306. <listitem>
  307. <para>Provide a prefix that the client id will be built
  308. from by appending the process id of the client. This is
  309. useful where the broker is using the clientid_prefixes
  310. option. Cannot be used at the same time as the
  311. <option>--id</option> argument.</para>
  312. </listitem>
  313. </varlistentry>
  314. <varlistentry>
  315. <term><option>--insecure</option></term>
  316. <listitem>
  317. <para>When using certificate based encryption, this option
  318. disables verification of the server hostname in the
  319. server certificate. This can be useful when testing
  320. initial server configurations but makes it possible for
  321. a malicious third party to impersonate your server
  322. through DNS spoofing, for example. Use this option in
  323. testing <emphasis>only</emphasis>. If you need to
  324. resort to using this option in a production
  325. environment, your setup is at fault and there is no
  326. point using encryption.</para>
  327. </listitem>
  328. </varlistentry>
  329. <varlistentry>
  330. <term><option>-k</option></term>
  331. <term><option>--keepalive</option></term>
  332. <listitem>
  333. <para>The number of seconds between sending PING commands
  334. to the broker for the purposes of informing it we are still
  335. connected and functioning. Defaults to 60 seconds.</para>
  336. </listitem>
  337. </varlistentry>
  338. <varlistentry>
  339. <term><option>--key</option></term>
  340. <listitem>
  341. <para>Define the path to a file containing a PEM encoded
  342. private key for this client, if required by the
  343. server.</para>
  344. <para>See also <option>--cert</option>.</para>
  345. </listitem>
  346. </varlistentry>
  347. <varlistentry>
  348. <term><option>--keyform</option></term>
  349. <listitem>
  350. <para>Specifies the type of private key in use when making
  351. TLS connections.. This can be "pem" or "engine". This
  352. parameter is useful when a TPM module is being used and
  353. the private key has been created with it. Defaults to
  354. "pem", which means normal private key files are
  355. used.</para>
  356. <para>See also <option>--tls-engine</option>.</para>
  357. </listitem>
  358. </varlistentry>
  359. <varlistentry>
  360. <term><option>-L</option></term>
  361. <term><option>--url</option></term>
  362. <listitem>
  363. <para>Specify specify user, password, hostname, port and
  364. topic at once as a URL. The URL must be in the form:
  365. mqtt(s)://[username[:password]@]host[:port]/topic</para>
  366. <para>If the scheme is mqtt:// then the port defaults to
  367. 1883. If the scheme is mqtts:// then the port defaults
  368. to 8883.</para>
  369. </listitem>
  370. </varlistentry>
  371. <varlistentry>
  372. <term><option>-m</option></term>
  373. <term><option>--message</option></term>
  374. <listitem>
  375. <para>Send a single request message from the command line.</para>
  376. </listitem>
  377. </varlistentry>
  378. <varlistentry>
  379. <term><option>-N</option></term>
  380. <listitem>
  381. <para>Do not append an end of line character to the payload
  382. when printing. This allows streaming of payload data
  383. from multiple messages directly to another application
  384. unmodified. Only really makes sense when not using
  385. <option>-v</option>.</para>
  386. </listitem>
  387. </varlistentry>
  388. <varlistentry>
  389. <term><option>-n</option></term>
  390. <term><option>--null-message</option></term>
  391. <listitem>
  392. <para>Send a null (zero length) request message.</para>
  393. </listitem>
  394. </varlistentry>
  395. <varlistentry>
  396. <term><option>--nodelay</option></term>
  397. <listitem>
  398. <para>Disable Nagle's algorithm for the socket. This means
  399. that latency of sent messages is reduced, which is
  400. particularly noticeable for small, reasonably infrequent
  401. messages. Using this option may result in more packets
  402. being sent than would normally be necessary.</para>
  403. </listitem>
  404. </varlistentry>
  405. <varlistentry>
  406. <term><option>-p</option></term>
  407. <term><option>--port</option></term>
  408. <listitem>
  409. <para>Connect to the port specified. If not given, the
  410. default of 1883 for plain MQTT or 8883 for MQTT over
  411. TLS will be used.</para>
  412. </listitem>
  413. </varlistentry>
  414. <varlistentry>
  415. <term><option>-P</option></term>
  416. <term><option>--pw</option></term>
  417. <listitem>
  418. <para>Provide a password to be used for authenticating with
  419. the broker. Using this argument without also specifying
  420. a username is invalid when using MQTT v3.1 or v3.1.1.
  421. See also the <option>--username</option> option.</para>
  422. </listitem>
  423. </varlistentry>
  424. <varlistentry>
  425. <term><option>--pretty</option></term>
  426. <listitem>
  427. <para>
  428. When using the JSON output format %j or %J, the default
  429. is to print in an unformatted fashion. Specifying
  430. <option>--pretty</option> prints messages in a prettier,
  431. more human readable format.</para>
  432. </listitem>
  433. </varlistentry>
  434. <varlistentry>
  435. <term><option>--proxy</option></term>
  436. <listitem>
  437. <para>Specify a SOCKS5 proxy to connect through. "None" and
  438. "username" authentication types are supported. The
  439. <option>socks-url</option> must be of the form
  440. <option>socks5h://[username[:password]@]host[:port]</option>.
  441. The protocol prefix <option>socks5h</option> means that
  442. hostnames are resolved by the proxy. The symbols %25,
  443. %3A and %40 are URL decoded into %, : and @
  444. respectively, if present in the username or
  445. password.</para>
  446. <para>If username is not given, then no authentication is
  447. attempted. If the port is not given, then the default
  448. of 1080 is used.</para>
  449. <para>More SOCKS versions may be available in the future,
  450. depending on demand, and will use different protocol
  451. prefixes as described in <citerefentry>
  452. <refentrytitle><link xlink:href="https://linux.die.net/man/1/curl">curl</link></refentrytitle>
  453. <manvolnum>1</manvolnum> </citerefentry>.</para>
  454. </listitem>
  455. </varlistentry>
  456. <varlistentry>
  457. <term><option>--psk</option></term>
  458. <listitem>
  459. <para>Provide the hexadecimal (no leading 0x)
  460. pre-shared-key matching the one used on the broker to
  461. use TLS-PSK encryption support.
  462. <option>--psk-identity</option> must also be provided
  463. to enable TLS-PSK.</para>
  464. </listitem>
  465. </varlistentry>
  466. <varlistentry>
  467. <term><option>--psk-identity</option></term>
  468. <listitem>
  469. <para>The client identity to use with TLS-PSK support. This
  470. may be used instead of a username if the broker is
  471. configured to do so.</para>
  472. </listitem>
  473. </varlistentry>
  474. <varlistentry>
  475. <term><option>-q</option></term>
  476. <term><option>--qos</option></term>
  477. <listitem>
  478. <para>Specify the quality of service desired for the
  479. incoming messages, from 0, 1 and 2. Defaults to 0. See
  480. <citerefentry><refentrytitle><link xlink:href="mqtt-7.html">mqtt</link></refentrytitle><manvolnum>7</manvolnum></citerefentry>
  481. for more information on QoS.</para>
  482. <para>The QoS is identical for all topics subscribed to in
  483. a single instance of mosquitto_rr.</para>
  484. </listitem>
  485. </varlistentry>
  486. <varlistentry>
  487. <term><option>--quiet</option></term>
  488. <listitem>
  489. <para>If this argument is given, no runtime errors will be
  490. printed. This excludes any error messages given in case of
  491. invalid user input (e.g. using <option>--port</option> without a
  492. port).</para>
  493. </listitem>
  494. </varlistentry>
  495. <varlistentry>
  496. <term><option>-R</option></term>
  497. <listitem>
  498. <para>If this argument is given, messages that are received
  499. that have the retain bit set will not be printed.
  500. Messages with retain set are "stale", in that it is not
  501. known when they were originally published. When
  502. subscribing to a wildcard topic there may be a large
  503. number of retained messages. This argument suppresses
  504. their display.</para>
  505. </listitem>
  506. </varlistentry>
  507. <varlistentry>
  508. <term><option>-S</option></term>
  509. <listitem>
  510. <para>Use SRV lookups to determine which host to connect
  511. to. Performs lookups to
  512. <option>_mqtt._tcp.&lt;host&gt;</option> when used in
  513. conjunction with <option>-h</option>, otherwise uses
  514. <option>_mqtt._tcp.&lt;local dns
  515. domain&gt;</option>.</para>
  516. </listitem>
  517. </varlistentry>
  518. <varlistentry>
  519. <term><option>-s</option></term>
  520. <term><option>--stdin-file</option></term>
  521. <listitem>
  522. <para>Send a request message read from stdin, sending the entire content as a single message.</para>
  523. </listitem>
  524. </varlistentry>
  525. <varlistentry>
  526. <term><option>-t</option></term>
  527. <term><option>--topic</option></term>
  528. <listitem>
  529. <para>The MQTT topic where the request message will be sent.</para>
  530. </listitem>
  531. </varlistentry>
  532. <varlistentry>
  533. <term><option>--tls-alpn</option></term>
  534. <listitem>
  535. <para>Provide a protocol to use when connecting to a broker
  536. that has multiple protocols available on a single port,
  537. e.g. MQTT and WebSockets.</para>
  538. </listitem>
  539. </varlistentry>
  540. <varlistentry>
  541. <term><option>--tls-engine</option></term>
  542. <listitem>
  543. <para>A valid openssl engine id. These can be listed with
  544. openssl engine command.</para>
  545. <para>See also <option>--keyform</option>.</para>
  546. </listitem>
  547. </varlistentry>
  548. <varlistentry>
  549. <term><option>--tls-engine-kpass-sha1</option></term>
  550. <listitem>
  551. <para>SHA1 of the private key password when using an TLS
  552. engine. Some TLS engines such as the TPM engine may
  553. require the use of a password in order to be accessed.
  554. This option allows a hex encoded SHA1 hash of the
  555. password to the engine directly, instead of the user
  556. being prompted for the password.</para>
  557. <para>See also <option>--tls-engine</option>.</para>
  558. </listitem>
  559. </varlistentry>
  560. <varlistentry>
  561. <term><option>--tls-use-os-certs</option></term>
  562. <listitem>
  563. <para>
  564. If used, this will load and trust the OS provided CA
  565. certificates. This can be used in conjunction with
  566. <option>--cafile</option> and <option>--capath</option>
  567. and can be used on its own to enable TLS mode. This
  568. will be set by default if <option>-L mqtts://...</option>
  569. is used, or if port is 8883 and no other certificate
  570. options are used.
  571. </para>
  572. </listitem>
  573. </varlistentry>
  574. <varlistentry>
  575. <term><option>--tls-version</option></term>
  576. <listitem>
  577. <para>Choose which TLS protocol version to use when
  578. communicating with the broker. Valid options are
  579. <option>tlsv1.3</option>, <option>tlsv1.2</option> and
  580. <option>tlsv1.1</option>. The default value is
  581. <option>tlsv1.2</option>. Must match the protocol
  582. version used by the broker.</para>
  583. </listitem>
  584. </varlistentry>
  585. <varlistentry>
  586. <term><option>-u</option></term>
  587. <term><option>--username</option></term>
  588. <listitem>
  589. <para>Provide a username to be used for authenticating with
  590. the broker. See also the <option>--pw</option>
  591. argument.</para>
  592. </listitem>
  593. </varlistentry>
  594. <varlistentry>
  595. <term><option>--unix</option></term>
  596. <listitem>
  597. <para>Connect to a broker through a local unix domain socket
  598. instead of a TCP socket. This is a replacement for
  599. <option>-h</option> and <option>-L</option>. For example:
  600. <option>mosquitto_pub --unix /tmp/mosquitto.sock ...</option>
  601. </para>
  602. <para>See the <option>socket_domain</option> option in
  603. <refentrytitle>
  604. <link xlink:href="mosquitto-conf-5.html">mosquitto.conf</link>
  605. </refentrytitle><manvolnum>5</manvolnum>
  606. to configure Mosquitto to listen on a unix socket.</para>
  607. </listitem>
  608. </varlistentry>
  609. <varlistentry>
  610. <term><option>-v</option></term>
  611. <term><option>--verbose</option></term>
  612. <listitem>
  613. <para>Print received messages verbosely. With this
  614. argument, messages will be printed as "topic payload". When
  615. this argument is not given, the messages are printed as
  616. "payload".</para>
  617. </listitem>
  618. </varlistentry>
  619. <varlistentry>
  620. <term><option>-V</option></term>
  621. <term><option>--protocol-version</option></term>
  622. <listitem>
  623. <para>Specify which version of the MQTT protocol should be
  624. used when connecting to the rmeote broker. Can be
  625. <option>5</option>, <option>311</option>,
  626. <option>31</option>, or the more verbose
  627. <option>mqttv5</option>, <option>mqttv311</option>, or
  628. <option>mqttv31</option>.
  629. Defaults to <option>5</option>.</para>
  630. </listitem>
  631. </varlistentry>
  632. <varlistentry>
  633. <term><option>--will-payload</option></term>
  634. <listitem>
  635. <para>Specify a message that will be stored by the broker
  636. and sent out if this client disconnects unexpectedly. This
  637. must be used in conjunction with <option>--will-topic</option>.</para>
  638. </listitem>
  639. </varlistentry>
  640. <varlistentry>
  641. <term><option>--will-qos</option></term>
  642. <listitem>
  643. <para>The QoS to use for the Will. Defaults to 0. This must
  644. be used in conjunction with <option>--will-topic</option>.</para>
  645. </listitem>
  646. </varlistentry>
  647. <varlistentry>
  648. <term><option>--will-retain</option></term>
  649. <listitem>
  650. <para>If given, if the client disconnects unexpectedly the
  651. message sent out will be treated as a retained message.
  652. This must be used in conjunction with <option>--will-topic</option>.</para>
  653. </listitem>
  654. </varlistentry>
  655. <varlistentry>
  656. <term><option>--will-topic</option></term>
  657. <listitem>
  658. <para>The topic on which to send a Will, in the event that
  659. the client disconnects unexpectedly.</para>
  660. </listitem>
  661. </varlistentry>
  662. <varlistentry>
  663. <term><option>-x</option></term>
  664. <listitem>
  665. <para>Set the session-expiry-interval property on the CONNECT packet.
  666. Applies to MQTT v5 clients only. Set to 0-4294967294 to specify
  667. the session will expire in that many seconds after the client
  668. disconnects, or use -1, 4294967295, or ∞ for a session that does
  669. not expire. Defaults to -1 if -c is also given, or 0 if -c not
  670. given.</para>
  671. <para>If the session is set to never expire, either with -x or -c, then
  672. a client id must be provided.</para>
  673. </listitem>
  674. </varlistentry>
  675. </variablelist>
  676. </refsect1>
  677. <refsect1 id='outputformat'>
  678. <title>Output format</title>
  679. <para>There are three ways of formatting the output from mosquitto_rr.
  680. In all cases a new-line character is appended for each message
  681. received unless the <option>-N</option> argument is passed to
  682. mosquitto_rr.</para>
  683. <para>Payload-only is the default output format and will
  684. print the payload exactly as it is received.</para>
  685. <para>Verbose mode is activated with <option>-v</option> and prints the
  686. message topic and the payload, separated by a space.</para>
  687. <para>The final option is formatted output, which allows the user to
  688. define a custom output format. The behaviour is controlled with
  689. the <option>-F format-string</option> option. The format string is
  690. a free text string where interpreted sequences are replaced by
  691. different parameters. The available interpreted sequences are
  692. described below.</para>
  693. <para>Three characters are used to start an interpreted sequence:
  694. <option>%</option>, <option>@</option> and <option>\</option>.
  695. Sequences starting with <option>%</option> are either parameters
  696. related to the MQTT message being printed, or are helper sequences
  697. to avoid the need to type long date format strings for example.
  698. Sequences starting with <option>@</option> are passed to the
  699. <citerefentry><refentrytitle><link xlink:href="https://linux.die.net/man/3/strftime">strftime</link></refentrytitle><manvolnum>3</manvolnum></citerefentry>
  700. function (with the @ replaced with a % - note that only the
  701. character immediately after the @ is passed to strftime). This
  702. allows the construction of a wide variety of time based outputs.
  703. The output options for strftime vary from platform to platform, so
  704. please check what is available for your platform. mosquitto_rr
  705. does provide one extension to strftime which is
  706. <option>@N</option>, which can be used to obtain the number of
  707. nanoseconds passed in the current second. The resolution of this
  708. option varies depending on the platform. The final sequence
  709. character is <option>\</option>, which is used to input some
  710. characters that would otherwise be difficult to enter.</para>
  711. <refsect2>
  712. <title>MQTT related parameters</title>
  713. <itemizedlist mark="circle">
  714. <listitem><para><option>%%</option> a literal %.</para></listitem>
  715. <listitem><para><option>%A</option> the MQTT v5 topic-alias property, if present.</para></listitem>
  716. <listitem><para><option>%C</option> the MQTT v5 content-type property, if present.</para></listitem>
  717. <listitem><para><option>%D</option> the MQTT v5 correlation-data property, if present. Note that this
  718. property is specified as binary data, so may produce non-printable characters.</para></listitem>
  719. <listitem><para><option>%E</option> the MQTT v5 message-expiry-interval property, if present.</para></listitem>
  720. <listitem><para><option>%F</option> the MQTT v5 payload-format-indicator property, if present.</para></listitem>
  721. <listitem><para><option>%l</option> the length of the payload in bytes.</para></listitem>
  722. <listitem><para><option>%m</option> the message id (only relevant for messages with QoS>0).</para></listitem>
  723. <listitem><para><option>%P</option> the MQTT v5 user-property property, if present. This will be printed in the
  724. form key:value. It is possible for any number of user properties to be attached to a message, and to
  725. have duplicate keys.</para></listitem>
  726. <listitem><para><option>%p</option> the payload raw bytes (may produce non-printable characters depending on the payload).</para></listitem>
  727. <listitem><para><option>%q</option> the message QoS.</para></listitem>
  728. <listitem><para><option>%R</option> the MQTT v5 response-topic property, if present.</para></listitem>
  729. <listitem><para><option>%r</option> the retained flag for the message.</para></listitem>
  730. <listitem><para><option>%S</option> the MQTT v5 subscription-identifier property, if present.</para></listitem>
  731. <listitem><para><option>%t</option> the message topic.</para></listitem>
  732. <listitem><para><option>%x</option> the payload with each byte as a hexadecimal number (lower case).</para></listitem>
  733. <listitem><para><option>%X</option> the payload with each byte as a hexadecimal number (upper case).</para></listitem>
  734. </itemizedlist>
  735. </refsect2>
  736. <refsect2>
  737. <title>Helpers</title>
  738. <itemizedlist mark="circle">
  739. <listitem><para><option>%I</option> ISO-8601 format date and time, e.g. 2016-08-10T09:47:38+0100</para></listitem>
  740. <listitem><para><option>%j</option> JSON output of message
  741. parameters and timestamp, with a quoted and escaped
  742. payload. For example
  743. <code>{"tst":"2020-05-06T22:12:00.000000+0100","topic":"greeting","qos":0,"retain":0,"payload":"hello
  744. world"}</code></para></listitem>
  745. <listitem><para><option>%J</option> JSON output of message
  746. parameters and timestamp, with a non-quoted and
  747. non-escaped payload - this means the payload must
  748. itself be valid JSON. For example:
  749. <code>{"tst":"2020-05-06T22:12:00.000000+0100","topic":"foo","qos":0,"retain":0,"payload":{"temperature":27.0,"humidity":57}}</code>.</para>
  750. <para>If the payload is not valid JSON, then the error message "Error: Message payload is not valid JSON on topic
  751. &lt;topic&gt;" will be printed to stderr.</para></listitem>
  752. <listitem><para><option>%I</option> ISO-8601 format date and time, e.g. 2016-08-10T09:47:38+0100</para></listitem>
  753. <listitem><para><option>%U</option> Unix timestamp with nanoseconds, e.g. 1470818943.786368637</para></listitem>
  754. </itemizedlist>
  755. </refsect2>
  756. <refsect2>
  757. <title>Time related parameters</title>
  758. <itemizedlist mark="circle">
  759. <listitem><para><option>@@</option> a literal @.</para></listitem>
  760. <listitem><para><option>@X</option> pass the character represented
  761. by <option>X</option> to the strftime function as
  762. <option>%X</option>. The options supported are platform
  763. dependent.</para></listitem>
  764. <listitem><para><option>@N</option> the number of nanoseconds that
  765. have passed in the current second, with varying timing
  766. resolution depending on platform.</para></listitem>
  767. </itemizedlist>
  768. </refsect2>
  769. <refsect2>
  770. <title>Escape characters</title>
  771. <itemizedlist mark="circle">
  772. <listitem><para><option>\\</option> a literal \.</para></listitem>
  773. <listitem><para><option>\0</option> a null character. Can be used
  774. to separate different parameters that may contain spaces
  775. (e.g. topic, payload) so that processing with tools such as
  776. <citerefentry><refentrytitle><link xlink:href="https://linux.die.net/man/1/xargs">xargs</link></refentrytitle><manvolnum>1</manvolnum></citerefentry>
  777. is easier.</para></listitem>
  778. <listitem><para><option>\a</option> alert/bell.</para></listitem>
  779. <listitem><para><option>\e</option> the escape sequence, which can
  780. be used with ANSI colour codes to provide coloured output
  781. for example.</para></listitem>
  782. <listitem><para><option>\n</option> end of line.</para></listitem>
  783. <listitem><para><option>\r</option> carriage return.</para></listitem>
  784. <listitem><para><option>\t</option> horizontal tab.</para></listitem>
  785. <listitem><para><option>\v</option> vertical tab.</para></listitem>
  786. </itemizedlist>
  787. </refsect2>
  788. </refsect1>
  789. <refsect1>
  790. <title>Wills</title>
  791. <para>mosquitto_rr can register a message with the broker that will be
  792. sent out if it disconnects unexpectedly. See
  793. <citerefentry><refentrytitle><link xlink:href="mqtt-7.html">mqtt</link></refentrytitle><manvolnum>7</manvolnum></citerefentry>
  794. for more information.</para>
  795. <para>The minimum requirement for this is to use <option>--will-topic</option> to
  796. specify which topic the will should be sent out on. This will result in
  797. a non-retained, zero length message with QoS 0.</para>
  798. <para>Use the <option>--will-retain</option>, <option>--will-payload</option> and <option>--will-qos</option> arguments to
  799. modify the other will parameters.</para>
  800. </refsect1>
  801. <refsect1 id='properties'>
  802. <title>Properties</title>
  803. <para>The <option>-D</option> / <option>--property</option> option
  804. allows adding properties to different stages of the mosquitto_rr
  805. run. The properties supported for each command are as
  806. follows:</para>
  807. <refsect2>
  808. <title>Connect</title>
  809. <itemizedlist>
  810. <listitem><para><option>authentication-data</option> (binary data - note treated as a string in mosquitto_rr)</para></listitem>
  811. <listitem><para><option>authentication-method</option> (UTF-8 string pair)</para></listitem>
  812. <listitem><para><option>maximum-packet-size</option> (32-bit unsigned integer)</para></listitem>
  813. <listitem><para><option>receive-maximum</option> (16-bit unsigned integer)</para></listitem>
  814. <listitem><para><option>request-problem-information</option> (8-bit unsigned integer)</para></listitem>
  815. <listitem><para><option>request-response-information</option> (8-bit unsigned integer)</para></listitem>
  816. <listitem><para><option>session-expiry-interval</option> (32-bit unsigned integer, note use <option>-x</option> instead)</para></listitem>
  817. <listitem><para><option>topic-alias-maximum</option> (16-bit unsigned integer)</para></listitem>
  818. <listitem><para><option>user-property</option> (UTF-8 string pair)</para></listitem>
  819. </itemizedlist>
  820. </refsect2>
  821. <refsect2>
  822. <title>Publish</title>
  823. <itemizedlist>
  824. <listitem><para><option>content-type</option> (UTF-8 string)</para></listitem>
  825. <listitem><para><option>correlation-data</option> (binary data - note treated as a string in mosquitto_rr)</para></listitem>
  826. <listitem><para><option>message-expiry-interval</option> (32-bit unsigned integer)</para></listitem>
  827. <listitem><para><option>payload-format-indicator</option> (8-bit unsigned integer)</para></listitem>
  828. <listitem><para><option>response-topic</option> (UTF-8 string)</para></listitem>
  829. <listitem><para><option>topic-alias</option> (16-bit unsigned integer)</para></listitem>
  830. <listitem><para><option>user-property</option> (UTF-8 string pair)</para></listitem>
  831. </itemizedlist>
  832. </refsect2>
  833. <refsect2>
  834. <title>Subscribe</title>
  835. <itemizedlist>
  836. <listitem><para><option>user-property</option> (UTF-8 string pair)</para></listitem>
  837. </itemizedlist>
  838. </refsect2>
  839. <refsect2>
  840. <title>Unsubscribe</title>
  841. <itemizedlist>
  842. <listitem><para><option>user-property</option> (UTF-8 string pair)</para></listitem>
  843. </itemizedlist>
  844. </refsect2>
  845. <refsect2>
  846. <title>Disconnect</title>
  847. <itemizedlist>
  848. <listitem><para><option>session-expiry-interval</option> (32-bit unsigned integer)</para></listitem>
  849. <listitem><para><option>user-property</option> (UTF-8 string pair)</para></listitem>
  850. </itemizedlist>
  851. </refsect2>
  852. <refsect2>
  853. <title>Will properties</title>
  854. <itemizedlist>
  855. <listitem><para><option>content-type</option> (UTF-8 string)</para></listitem>
  856. <listitem><para><option>correlation-data</option> (binary data - note treated as a string in mosquitto_pub)</para></listitem>
  857. <listitem><para><option>message-expiry-interval</option> (32-bit unsigned integer)</para></listitem>
  858. <listitem><para><option>payload-format-indicator</option> (8-bit unsigned integer)</para></listitem>
  859. <listitem><para><option>response-topic</option> (UTF-8 string)</para></listitem>
  860. <listitem><para><option>user-property</option> (UTF-8 string pair)</para></listitem>
  861. <listitem><para><option>will-delay-interval</option> (32-bit unsigned integer)</para></listitem>
  862. </itemizedlist>
  863. </refsect2>
  864. </refsect1>
  865. <refsect1>
  866. <title>Exit Values</title>
  867. <variablelist>
  868. <varlistentry>
  869. <term><option>0</option></term>
  870. <listitem><para>Success</para></listitem>
  871. </varlistentry>
  872. <varlistentry>
  873. <term><option>27</option></term>
  874. <listitem><para>Timed out waiting for message</para></listitem>
  875. </varlistentry>
  876. <varlistentry>
  877. <term><option>Other non-zero value</option></term>
  878. <listitem><para>Unspecified failure</para></listitem>
  879. </varlistentry>
  880. </variablelist>
  881. </refsect1>
  882. <refsect1>
  883. <title>Files</title>
  884. <variablelist>
  885. <varlistentry>
  886. <term><filename>$XDG_CONFIG_HOME/mosquitto_rr</filename></term>
  887. <term><filename>$HOME/.config/mosquitto_rr</filename></term>
  888. <listitem>
  889. <para>Configuration file for default options.</para>
  890. </listitem>
  891. </varlistentry>
  892. </variablelist>
  893. </refsect1>
  894. <refsect1>
  895. <title>Bugs</title>
  896. <para><command>mosquitto</command> bug information can be found at
  897. <ulink url="https://github.com/eclipse/mosquitto/issues"/></para>
  898. </refsect1>
  899. <refsect1>
  900. <title>See Also</title>
  901. <simplelist type="inline">
  902. <member>
  903. <citerefentry>
  904. <refentrytitle><link xlink:href="mqtt-7.html">mqtt</link></refentrytitle>
  905. <manvolnum>7</manvolnum>
  906. </citerefentry>
  907. </member>
  908. <member>
  909. <citerefentry>
  910. <refentrytitle><link xlink:href="mosquitto_pub-1.html">mosquitto_pub</link></refentrytitle>
  911. <manvolnum>1</manvolnum>
  912. </citerefentry>
  913. </member>
  914. <member>
  915. <citerefentry>
  916. <refentrytitle><link xlink:href="mosquitto_sub-1.html">mosquitto_sub</link></refentrytitle>
  917. <manvolnum>1</manvolnum>
  918. </citerefentry>
  919. </member>
  920. <member>
  921. <citerefentry>
  922. <refentrytitle><link xlink:href="mosquitto-8.html">mosquitto</link></refentrytitle>
  923. <manvolnum>8</manvolnum>
  924. </citerefentry>
  925. </member>
  926. <member>
  927. <citerefentry>
  928. <refentrytitle><link xlink:href="libmosquitto-3.html">libmosquitto</link></refentrytitle>
  929. <manvolnum>3</manvolnum>
  930. </citerefentry>
  931. </member>
  932. <member>
  933. <citerefentry>
  934. <refentrytitle><link xlink:href="mosquitto-tls-7.html">mosquitto-tls</link></refentrytitle>
  935. <manvolnum>7</manvolnum>
  936. </citerefentry>
  937. </member>
  938. </simplelist>
  939. </refsect1>
  940. <refsect1>
  941. <title>Author</title>
  942. <para>Roger Light <email>roger@atchoo.org</email></para>
  943. </refsect1>
  944. </refentry>