Invalidating existing friendships

If more than a day has passed, and we still do not get data from the sensor, we invalidate the connection, and remove the annotations we have stored for the corresponding roster item:

else if (SecondsSinceLastEvent > 60 * 60 * 24) 
{ 
   if (!string.IsNullOrEmpty(this.sensorJid)) 
   { 
         Item = this.xmppClient[this.sensorJid]; 
 
         this.sensor = null; 
         this.sensorJid = null; 
 
         if (Item != null) 
         { 
               this.xmppClient.UpdateRosterItem(this.sensorJid, 
                     Item.Name, this.RemoveReference(Item.Groups, 
                     "Sensor")); 
         } 
   } 
 
   Search = true; 
} 
Here, the RemoveReference() method removes the groups used for annotating the roster item, and that is used by the AddReference() and GetReference() methods. See the GitHub repository for details.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset