Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dumped packet issue coreMQTT library (CA-324) #209

Open
anuarrozman opened this issue Dec 5, 2023 · 0 comments
Open

Dumped packet issue coreMQTT library (CA-324) #209

anuarrozman opened this issue Dec 5, 2023 · 0 comments

Comments

@anuarrozman
Copy link

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;
}`
@github-actions github-actions bot changed the title Dumped packet issue coreMQTT library Dumped packet issue coreMQTT library (CA-324) Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant