KxSystems / mqtt

MQTT messaging protocol interface
https://code.kx.com/q/interfaces
Apache License 2.0
9 stars 12 forks source link

WIP: Enable last will #39

Closed rianoc closed 3 years ago

rianoc commented 3 years ago

Enable the library to use last will during connection

https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/struct_m_q_t_t_client__will_options.html

To test:

$ mosquitto_sub -v -t "test"
\l mqtt.q
opts:`lastWillTopic`lastWillQos`lastWillMessage`lastWillRetain!(`test;2i;"disconnect";0i)
.mqtt.conn[`localhost:1883;`src;opts]
\\

mosquitto_sub will print:

test disconnect
nmcdonnell-kx commented 3 years ago

One problem - the mac build is failing on Travis. The problem is the use of strndup which I believe is a GNU extension that isn't support on earlier OS X builds. We could bump the travis OS X image (as is done by arrowkdb) but it's probably easier to change the strndup to a malloc + memcpy (or just use plain strdup if the strings don't contain \0 chars)