We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Credit goes to Luis: https://www.luisllamas.es/en/how-to-use-async-mqtt-on-esp8266-esp32-with-asyncmqttclient/
//if Subscribe, setup payload content catching String GetPayloadContent(char* data, size_t len) { String content = ""; for(size_t i = 0; i < len; i++) { content.concat(data[i]); } return content; }
void onMqttReceived(char* topic, char* payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) { Serial.print("Received on "); Serial.print(topic); Serial.print(": ");
String content = GetPayloadContent(payload, len); Serial.print(content); Serial.println(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Credit goes to Luis:
https://www.luisllamas.es/en/how-to-use-async-mqtt-on-esp8266-esp32-with-asyncmqttclient/
//if Subscribe, setup payload content catching
String GetPayloadContent(char* data, size_t len)
{
String content = "";
for(size_t i = 0; i < len; i++)
{
content.concat(data[i]);
}
return content;
}
void onMqttReceived(char* topic, char* payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total)
{
Serial.print("Received on ");
Serial.print(topic);
Serial.print(": ");
String content = GetPayloadContent(payload, len);
Serial.print(content);
Serial.println();
}
The text was updated successfully, but these errors were encountered: