-
Notifications
You must be signed in to change notification settings - Fork 755
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
Client never closes socket #235
Comments
What is 'c' ? In which module ? In which file ?
|
I use this repo with FreeRTOS and LwIP stack. I do something like that: while (1) {
do {
NetworkInit(&network);
MQTTClientInit(&client, &network, 30000, sendbuf, sizeof(sendbuf), readbuf, sizeof(readbuf));
if ((rc = NetworkConnect(&network, broker_addr, 1883)) != 0) {
continue;
}
// Fill connectData
if ((rc = MQTTConnect(&client, &connectData)) != 0) {
continue;
}
// Subscribe
} while (rc != SUCCESS);
while (1) {
if ((rc = MQTTYield(&client, 500)) != 0) {
break;
}
}
} What is the proper way to handle connection errors (reconnect to broker on error)? Should I close connection every time MQTTYield() returns negative value or FAILURE only? Is there any reason not to use disconnect callback from MQTTCloseSession()? |
c->disconnect() should be called inside MQTTCloseSession()
The text was updated successfully, but these errors were encountered: