March 2018
Beginner to intermediate
410 pages
10h 40m
English
The XmppClient object will try to maintain the connection live. This includes pinging the server and trying to reconnect if something happens. But connectivity can get lost for many reasons. The application should therefore regularly check the connection, and force a reconnection attempt if it finds it offline or in an error state. In our sensor project, we can check the connection every minute, and force it to reconnect if necessary. We can take the opportunity to use our sampling timer to achieve this:
if (Timestamp.Second == 0 && this.xmppClient != null &&
(this.xmppClient.State == XmppState.Error ||
this.xmppClient.State == XmppState.Offline))
{
this.xmppClient.Reconnect();
}
In the actuator, as we don't have ...
Read now
Unlock full access