'''MQTT''' stands for [https://en.wikipedia.org/wiki/MQTT%|%Message Queue Telemetry Transport]. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks. 2017-06-05 [sbron] I created an MQTT client library and published it on https://chiselapp.com/user/schelte/repository/mqtt%|%chiselapp%|% 2017-08-21 [dzach] Thanks [sbron]! The client library works nicely with [https://mosquitto.org/%|%mosquitto]. Maybe it should find its place in tcllib? Is there a way to figure out if a client is currently connected to an mqtt broker? ---- '''[gambitcomm] - 2017-10-13 14:15:21''' I am running a simple subscriber client with this code, eg. ====== set client [mqtt new] $client connect uwe-client $::addr $client subscribe {BCDS/#} message_callback ====== and while it works with a local broker, eg. mosquitto, it fails with an internet broker, eg. iot.eclipse.org. The stack trace is ====== your script1507901608909 (::oo::Obj22_coro): can't read "msgid": no such variable while executing "dict set rc msgid $msgid" (class "::mqtt" method "receive" line 35) invoked from within "my receive" (class "::mqtt" method "listen" line 27) invoked from within "my listen" ====== While debugging this problem, it seems that the API cannot handle concatenated messages into one packet. I cannot prove it without much effort. Can someone tell me yes or no whether concatenated messages are handled properly, eg. the packet to the receive method contains a MQTT request and a half? '''[chw] 2018-09-26''' See the patch https://www.androwish.org/index.html/info/fcedb208a754d073 which deals with the case of partial MQTT messages in the receive method. It allows me to watch the German river and sea levels using the mosquitto test broker with this little snippet: ====== package require mqtt proc cb {topic content} { puts "$topic: [encoding convertfrom utf-8 $content]" } set client [mqtt new] $client connect test-client test.mosquitto.org 1883 $client subscribe "de.wsv/pegel/#" cb vwait forever ====== '''[EF] 2018-10-01''' I have made available a slightly modified version of [sbron]'s excellent library at https://github.com/efrecon/mqtt%|%github%|%. My version adds the ability to specify the socket command to use for opening connections, thus making it easy to connect to remote facing MQTT servers with TLS. The fix is also proposed as a https://chiselapp.com/user/schelte/repository/mqtt/tktview?name=3f256a209b%|%github%|% at the original project. In addition, I also have a wrapper with a number of additional features. The wrapper requires https://github.com/efrecon/toclbox%|%toclbox%|% to function. Advantages brought by the wrapper are all explained in the main https://github.com/efrecon/mqtt/blob/master/README.md%|%README%|%, but in short it brings: * Automatic reconnection (exponential backoff) to the broker. * Client naming interface to benefit from persistent sessions. * Message enqueuing during connection losses sessions. * Logging <>Interprocess Communication | Message Broker