I'd start with getting rid of all these String()
statements and rather use snprintf()
.
Additionally I'd consider wrapping your readings up into a single event (e.g. as JSON string).
I'd also separate data acquisition from data transfer.
You may also want to not unconditionally call client.connect()
when you potentially still have a (re)usable connection.
Which brings us back to some discussion we already had a while ago
With each instance when you were given some hints and then not applying them, the urge to help keeps getting less and less.
In that very thread I even provided a fully working code that does all that and most likely would not suffer from the problem you are facing now.