It's well known that the Arduino IDE doesn't support changing defines at compile time in libraries. Issue #110 addresses this for another define, but I think the cons brought up in that conversation don't apply to the MQTT_KEEPALIVE define. It is only used in connect so I believe this would be simple to add as an optional argument to connect, and wouldn't take up any additional memory space.
I'm happy to submit a PR if this would theoretically get accepted.
This argument also mostly applies to MQTT_SOCKET_TIMEOUT, but it would need to be stored in the class for readByte to use it. I could make this change at the same time.
Agreed - making this dynamic is a significantly smaller overhead than the buffer size.
Happy to look at a PR for it
Have just pushed a fix that adds setKeepAlive. Thanks for proposing this change - sorry it took so long to come to a resolution.
Most helpful comment
Agreed - making this dynamic is a significantly smaller overhead than the buffer size.
Happy to look at a PR for it