Dumped packet issue coreMQTT library (CA-324)
anuarrozman opened this issue · comments
Hi, Im currently receiving JSON payload from MQTT shadow topic and having this error
E (14264) coreMQTT: Dumped packet. DumpedBytes=19. E (14264) coreMQTT: Dumped packet. DumpedBytes=46.
I need help on increasing the size.
This is how handle to read/receive the JSON payload
` // Increase buffer size to receive the whole JSON payload
char *payloadBuffer = (char *)malloc(pPublishInfo->payloadLength + 1);
if (payloadBuffer == NULL) {
LogError(("Failed to allocate memory for payload buffer!"));
eventCallbackError = true;
return;
}
// Copy the payload data into the buffer
memcpy(payloadBuffer, pPublishInfo->pPayload, pPublishInfo->payloadLength);
payloadBuffer[pPublishInfo->payloadLength] = '\0';
// Print the parsed JSON for debugging
LogInfo(("Received JSON:\n%s", payloadBuffer));
// Parse the entire JSON payload using cJSON
cJSON *jsonObject = cJSON_Parse(payloadBuffer);
// Free the allocated memory for payload buffer
free(payloadBuffer);
if (jsonObject == NULL) {
LogError(("Failed to parse JSON payload!!"));
eventCallbackError = true;
return;
}`