Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Paho C: Reconnection callback

Hi,

I am working with Paho C library in asynchronous fashion and I would like to know the way of knowing that client has been reconnected. I will try to explain it deeper:

 

Suppose you connect the client to a broker with automaticReconnect option and the broker is restarted so the client lose its connection, calling to lostConenction callback. That is right, the user could know that the clients is now disconnected. The client would try to reconnect to broker. Once the broker is up again and the Paho client has successfully reconnected to it, there is no way to notify to the user that the client is connected again.

 

 

 

I expected that connectionCallback would be invoked again but not, since the function MQTTAsync_receiveThread(void* n) sets the connect callback to NULL to avoid call it again:

 

m->connect._onSuccess_ = NULL; /* don't accidentally call it again */

 

 

Is this the expected behavior? As user, I would like to know when my client has lost the connection but also when it recovers the connection again. I do not understand either why to clean connect.onSuccess callback to avoid calling it again but not connect.onFailure, allowing me (as user) to know every time reconnection fails but not when it success.

 

Just as a note, if the previous code line is commented I get the expected behavior.

 

Thank you so much for your tips.

Adrián M.

 

 

 

Adrián Morán Montes

Information and Communication Technologies
amoran@xxxxxxxxxx

logo_ik4_ikerlan

ImgFirma02-.gif

 www.ikerlan.es
   

IKERLAN
Pº J. M. Arizmendiarrieta, 2
20500 Arrasate-Mondragón (Gipuzkoa)
Tel.: +34 943 71 24 00

• Mezu honen informazioa isilpekoa izan daiteke eta indarrean dagoen legediak babesten du. Hutsegite baten ondorioz jaso baduzu, bidal iezaiozu berriro bidaltzaileari eta ezaba ezazu. Milesker zure laguntzagatik. • Behar beharrezkoa baino ez inprimatu, gogoratu zure INGURUMENarekiko konpromisoa.

• La información de este correo puede ser confidencial y está protegida por la legislación vigente. Si ha recibido este correo por error, reenvíelo a su emisor y elimínelo. Gracias por su ayuda. • Imprime sólo lo imprescindible, recuerda tu compromiso con el MEDIO AMBIENTE.

• This e-mail may contain confidential information that is protected by our laws. If you have received this e-mail by mistake, please, notify the sender and delete it. Thank you for your help. • Before printing think about the ENVIRONMENT.

 


Back to the top