mqtt
MQTT client for IoT messaging (pub/sub, QoS, retained messages).
Load with: use mqtt
Quick example
use mqtt
result = mqtty("hello", "value")
prn(result)
Functions
Connection
mqtty(cid, opts)
Performs the operation. Takes cid, opts.
mqttx(c)
Performs the operation. Takes c.
Connect
mqttc(c)
Performs the operation. Takes c.
Publish
mqttk(c, tp, msg, qos, rt)
Performs the operation. Takes c, tp, msg, qos, rt.
mqtta(c, tp, obj, qos, rt)
Performs the operation. Takes c, tp, obj, qos, rt.
Subscribe
mqttu(c, tp, qos, fn)
Performs the operation. Takes c, tp, qos, fn.
mqtt5(c, tp)
Performs the operation. Takes c, tp.
Message loop
mqtt8(c, to)
Performs the operation. Takes c, to.
mqttl(c)
Performs the operation. Takes c.
Will message
mqtte(c, tp, msg, qos, rt)
Performs the operation. Takes c, tp, msg, qos, rt.
QoS handling
mqttf(c, mid)
Performs the operation. Takes c, mid.
mqtto(c, mid)
Converts to another format. Takes c, mid.
mqttq(c, mid)
Performs the operation. Takes c, mid.
mqttg(c, mid)
Performs the operation. Takes c, mid.
Retained messages
mqtt3(c, tp)
Performs the operation. Takes c, tp.
Last will and testament
mqtth(c, tp, msg, qos)
Performs the operation. Takes c, tp, msg, qos.
Properties (MQTT 5.0)
mqtt9(c, props)
Performs the operation. Takes c, props.
Message object
mqtti(tp, payload, qos, rt)
Performs the operation. Takes tp, payload, qos, rt.
Topic helpers
mqtt4(tp)
Performs the operation. Takes tp.
mqtt2(tp, pat)
Performs the operation. Takes tp, pat.
mqttw(pat)
Performs the operation. Takes pat.
JSON payload helpers
mqtt7(c, tp, obj, qos, rt)
Performs the operation. Takes c, tp, obj, qos, rt.
mqttj(msg)
Performs the operation. Takes msg.
Binary payload
mqtt6(c, tp, data, qos, rt)
Performs the operation. Takes c, tp, data, qos, rt.
Callbacks
mqtnc(c, fn)
Performs the operation. Takes c, fn.
mqtnd(c, fn)
Performs the operation. Takes c, fn.
mqtnm(c, fn)
Performs the operation. Takes c, fn.
Connection state
mqtts(c)
Performs the operation. Takes c.
mqttr(c)
Performs the operation. Takes c.
Auto reconnect loop
mqttt(c, delay, maxt)
Performs the operation. Takes c, delay, maxt.
Discovery (Homie/HA convention)
mqttd(c, devid, nodes)
Performs the operation. Takes c, devid, nodes.
Bridge/Gateway
mqttb(incoming, outgoing, mapfn)
Performs the operation. Takes incoming, outgoing, mapfn.
Store and forward (offline buffering)
mqttn(cid, opts)
Performs the operation. Takes cid, opts.
mqttp(c, tp, msg, qos, rt)
Performs the operation. Takes c, tp, msg, qos, rt.
TLS/SSL
mqttv(ca, cert, key)
Performs the operation. Takes ca, cert, key.
WebSocket transport
mqttz(url)
Performs the operation. Takes url.
Metrics
mqttm(c)
Performs the operation. Takes c.
Test broker (mosquitto-like embedded)
mqtt0(opts)
Performs the operation. Takes opts.
mqtt1(b)
Performs the operation. Takes b.
Notes
- MQTT client - connect, publish, subscribe to topics.