I'm facing a weird problem which I don't understand (well, I'm still some king of a newbee ...).
I'm sending a JSON formatted string to a MQTT broker (local, hosted on a Debian Buster server where Node-Red also resides) with an Arduino and retrieve it with Node-Red.
Like this, it works. But if I uncomment the 4 lines .. it stops working ... I don't get anything anymore (while the serial output from the arduino is correct, it's not a problem with the Arduino sketch.
That doesn't look like valid code though it is difficult to be certain what sort of quotes they are. Some of the earlier lines don't look valid either. In the editor do you see an error indicator against that line? If not then feed the output into a debug node and see what it looks like before and after uncommenting the lines.
don't you need a backslash to escape the double quotes? So your first line should be String jsonPayload = "{\"DHT_1_t\":\"";
it may be that they were removed because you didn't enclose your code with three back tic's (```) before and after your code.
p.s. if you are using PubSubClient then I beleive the limit is 128 which you can change
// MQTT_MAX_PACKET_SIZE : Maximum packet size
#ifndef MQTT_MAX_PACKET_SIZE
#define MQTT_MAX_PACKET_SIZE 384 // need to fix this here, because this define cannot be overruled within the Arduino sketch...
#endif