Registering the Callback Object
You use the
awRegisterClientConnectionCallback function to register the callback function you wish to be invoked in the event your
Broker client is disconnected or reconnected to its
Broker. This function accepts three parameter.
The
Broker client for which the callback is being registered.
The callback function being registered.
A un-typed pointer to any data the function may need to complete its processing.
Note:
Any callback functions previously registered for a Broker client will be replaced by the one currently being registered.
When the callback function is invoked, the connect_state parameter will be set to one of the following values shown below.
connect_state | Meaning |
AW_CONNECT_STATE_DISCONNECTED | The client has been disconnected. |
AW_CONNECT_STATE_CONNECTED | The Client connection has been re-established, because automatic reconnect was enabled. |
AW_CONNECT_STATE_RECONNECTED | The Client was disconnected, but the connection was re-established immediately. This only happens if the automatic reconnect feature is enabled and the connection is re-established before a disconnected state can be reported. |