Commit 80dcde41 authored by Ian Craggs's avatar Ian Craggs

Set client object for connlost callback in MQTTAsync_subscribe sample #176

parent 7f0e3a26
...@@ -45,6 +45,7 @@ void connlost(void *context, char *cause) ...@@ -45,6 +45,7 @@ void connlost(void *context, char *cause)
int rc; int rc;
printf("\nConnection lost\n"); printf("\nConnection lost\n");
if (cause)
printf(" cause: %s\n", cause); printf(" cause: %s\n", cause);
printf("Reconnecting\n"); printf("Reconnecting\n");
...@@ -143,7 +144,7 @@ int main(int argc, char* argv[]) ...@@ -143,7 +144,7 @@ int main(int argc, char* argv[])
MQTTAsync_create(&client, ADDRESS, CLIENTID, MQTTCLIENT_PERSISTENCE_NONE, NULL); MQTTAsync_create(&client, ADDRESS, CLIENTID, MQTTCLIENT_PERSISTENCE_NONE, NULL);
MQTTAsync_setCallbacks(client, NULL, connlost, msgarrvd, NULL); MQTTAsync_setCallbacks(client, client, connlost, msgarrvd, NULL);
conn_opts.keepAliveInterval = 20; conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1; conn_opts.cleansession = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment