Open wildbiotiger opened 11 months ago
@wildbiotiger I see the message_callback_add(topic, callback)
is an attribute of the underlying Paho Client class. You could do something like the following:
from clearblade.ClearBladeCore import System
system = System("mySystemKey", "MYSYSTEMSECRET", url="https://community.clearblade.com")
mqtt = system.Messaging(user_device, port=1884, use_tls=True)
underlying_paho_client = mqtt._Messaging__mqttc
print(dir(underlying_paho_client))
...
The last print will show all the attributes of the underlying paho client object you have access to including message_callback_add
.
Will this help? Let me know if I'm missing something.
Yes, that's how I'm handling it currently. I'm not a fan of trying to dodge Python name mangling, but exposing or wrapping the functions of the Paho client would be a great enhancement.
@wildbiotiger is it just attributes from the underlying Client class that you want exposed or wrapped? And would it be all attributes or just certain ones in addition to message_callback_add
?
It's better to have ALL of them wrapped (or just expose the MQTT client variable as a public property). Whichever way is fine by me. message_callback_add
is just the most important one for me.
Could the Messaging API be updated to expose additional features of the underlying Paho MQTT class? Looking for functions like
message_callback_add(topic, callback)
and other wrapped functions. They can be direct passthroughs, but it seems that the Messaging functionality is unnecessarily limited without these hooks.