I'm new to the forum and this is my first post - my apologies in advance if I am violating some unspoken rules (I did read the Forum etiquette).
I am trying to build a kiosk style display that is fed by mqtt messages. My general problem is that my callback from the mqtt subscribe function seems not to be fired. I wonder if this is a general problem (only love internal callbacks are called/permitted, e.g. draw) or if I am doing something wrong?
Code: Select all
--set up all mqtt related -> https://github.com/Yongke/luamqttc
local MQTT = require("luamqttc/client")
local myMQTT = MQTT.new("showy") --showy = clientID
local myMQTT_server = "lsrpi"
local myMQTT_port = "1883"
local myMQTT_timeout = 1
local myMQTT_topic = "#"
function mqttMsgReceived(topic, data, packet_id, dup, qos, retained)
print("cb 1: ", topic, data, packet_id, dup, qos, retained)
end
function love.load()
if myMQTT:connect(myMQTT_server, myMQTT_port, {timeout=myMQTT_timeout}) == false then
print("mqtt connect failed")
else
print("mqtt connect ok")
end
myMQTT:subscribe(myMQTT_topic, 2, mqttMsgReceived, myMQTT_timeout)
mqttMsgReceived("topic", "data", "packetid", "dup", "qos", "retained")
end
function love.update(dt)
end
function love.draw()
end