Closed alve89 closed 1 year ago
As far as I understand the available methods, there only one way to access message to subscribed topics:
String currentTopic = ""; String currentPayload = ""; void messageReceived(String, String); void setup() { // Do all configuration here } void loop() { mqttClient.onMessage(messageReceivced); } void messageReceived(String &topic, String &payload) { currentTopic = topic; currentPayload = payload; }
Especially when using OOP this is a quite inefficient way. What do you think of adding a method like String readTopic(String topic) which returns the current payload of the topic?
String readTopic(String topic)
@alve89 Can't you simply create a wrapper yourself that does this for you? the messageReceived() gives you the message that was just recevied.
Closing as probably solved.
As far as I understand the available methods, there only one way to access message to subscribed topics:
Especially when using OOP this is a quite inefficient way. What do you think of adding a method like
String readTopic(String topic)
which returns the current payload of the topic?