Pubsubclient: Make MQTT_KEEPALIVE modifiable at runtime

Created on 30 Jun 2016  路  2Comments  路  Source: knolleary/pubsubclient

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.

enhancement

Most helpful comment

Agreed - making this dynamic is a significantly smaller overhead than the buffer size.

Happy to look at a PR for it

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dagnall53 picture dagnall53  路  4Comments

kbialkowski picture kbialkowski  路  7Comments

HobbytronicsPK picture HobbytronicsPK  路  4Comments

warriorfenixSM picture warriorfenixSM  路  6Comments

i17brn picture i17brn  路  9Comments