Repository navigation
What's Changed
Larger buffer size is now supported, via a new optional last constructor argument (maxBufferSz).
Note:
- Backward-compatible with existing API, defaults to existing buffer sizes
- Both Adafruit_MQTT and Adafruit_MQTT_Subscribe will attempt to first allocate using PSRAM (if avaliable) and fall back to heap-based allocation.
- For subscriptions - we ensure the buffer is large enough for the expected payload.
- Updated functions which handle MQTT packets to use the allocated buffer size instead of static variables
- Added error handling for memory allocation failures.
Example Call:
These changes allow buffer sizes to be configured in code, and compiled prior to runtime.:
#define BUFFER_LEN 2048 // 2048-byte buffer
// Initialize a new MQTT client with a 2048-byte buffer
Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, MQTT_SERVER_PORT, "", USER, PASS, BUFFER_LEN);
Full Changelog: 2.6.6...3.0.0