As the title says... Chat on...

User avatar
By cmaciel
#58335 Is it normal for the MQTT publish to generate a panic if it fails? I have a code that works fine, provided that the MQTT broker is up and running. If I shut it down, and try to publish a message, it panics with the following message:

PANIC: unprotected error in call to Lua API (not connected)

This is the code where it panics:

Code: Select allm:publish("domoticz/in",msg,0,0, function(conn)
             print("publish success")
          end)

Should I treat the return code, in order to prevent the panic if it fails?
Thanks
Cesar