Chat freely about anything...

User avatar
By Rabis.49
#73675 Hi,
I try to interpet a subscribe message but only
Code: Select allprint
work correct. All other statements increases with every time period.
Coud be a callback problem ???
If no message is received (in 5 seconds) than nothing happens, thats okay.
Some ideas everyone, please :roll:
Thanks for help
Rabis

LUA 5.1.4 , SDK 2.1.0
______________________________________________________________
Code: Select allfunction Output (message)
   print(message)
end

function mqtt_do()
  m:on("message", function(serverIP, topic_subscribe, data)
              if data ~= nil then
                   print(" " .. topic_subscribe .. ": '" .. data .. "'")   -- works fine!
                   Output(data)                                            -- 1.periode: 1 time ,
                                                                           -- 2.periode. 2 times and so on ...
              end
          end)
end

tmr.alarm(0, 5000, 1, function() mqtt_do() end)  -- every 5 seconds