upadte esp mqtt client

This commit is contained in:
technyon
2023-02-26 14:34:08 +01:00
parent 8fd17206dd
commit b14ea6326e
27 changed files with 454 additions and 203 deletions

View File

@@ -312,11 +312,13 @@ Publish a packet with a callback for payload handling. Return the packet ID (or
The callback has the following signature: `size_t callback(uint8_t* data, size_t maxSize, size_t index)`. When the library needs payload data, the callback will be invoked. It is the callback's job to write data indo `data` with a maximum of `maxSize` bytes, according the `index` and return the amount of bytes written.
```cpp
void clearQueue()
void clearQueue(bool deleteSessionData = false)
```
When disconnected, clears all queued messages.
Keep in mind that this also deletes any session data and therefore is no MQTT compliant.
Clears all queued messages.
Keep in mind that this may also delete any session data and therefore is not MQTT compliant.
- **`deleteSessionData`**: When true, delete all outgoing messages. Not MQTT compliant!
```cpp
void loop()
@@ -361,12 +363,19 @@ Set this to 1 if you use the async version on ESP8266. For the regular client th
### EMC_ALLOW_NOT_CONNECTED_PUBLISH 1
By default, you can publish when the client is not connected. If you don't want this, set this to 0.
Regardless of this setting, after you called `disconnect()`, no messages can be published until fully disconnected.
### EMC_WAIT_FOR_CONNACK 1
espMqttClient waits for the CONNACK (connection acknowledge) packet before starting to send other packets.
The MQTT specification allows to start sending before the broker acknowledges the connection but some brokers
don't allow this (AWS for example doesn't).
### EMC_CLIENTID_LENGTH 18 + 1
The (maximum) length of the client ID. (Keep in mind that this is a c-string. You need to have 1 position available for the null-termination.)
### EMC_TASK_STACK_SIZE 5000
### EMC_TASK_STACK_SIZE 5120
Only used on ESP32. Sets the stack size (in words) of the MQTT client worker task.