curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: MQTT

From: Christoph Krey via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 15 Apr 2020 20:01:47 +0200

Hello,

>
> I tried doing:
>
> ./curl 'mqtt://test.mosquitto.org/de.wsv/pegel/cm/ems/emshoern' --output -
>
> That topic currently has a retained message with content "582". The
> response I get from curl is:
>
> curl: (8) Weird server reply
> de.wsv/pegel/cm/ems/emshoern582

in MQTT protocol, the server may start to send PUBLISH messages (especially if those are retained) before replying with SUBACK to a SUBSCRIBE.

The current implementation in curl waits for a SUBACK or DISCONNECT after the SUBSCRIBE.

The ‘failure’ return code in the SUBACK should be checked.
>
>> ./curl mqtt://test.mosquitto.org/de.wsv/#
>> ./curl 'mqtt://test.mosquitto.org/de.wsv/#'
>>
>> Which I would expect would subscribe using the multilevel wildcard '#'. I
>> tried both forms to try and be sure that it wasn't the shell swallowing the
>> #.
>
> '#' is special in URLs, as it marks a fragment. You need to URL encoded such
> characters as %23.
>

Good to know!
>
> We might need a way to tell curl to disconnect after a certain number of
> responses or something…

Other than the test broker in curl `mqttd` a real broker will not send DISCONNECT after sending a PUBLISH message.

curl should either disconnect after a certain number of PUBLISH messages was received and after a timeout if no (new) message were received.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-04-15