March 2018
Beginner to intermediate
410 pages
10h 40m
English
When a new roster item has been added, you need to make sure you subscribe to its presence if it's a sensor or actuator. Otherwise, you will not be able to communicate with it properly:
private void XmppClient_OnRosterItemAdded(object Sender,
RosterItem Item)
{
Log.Informational("Roster item added.", Item.BareJid);
if (Item.IsInGroup("Sensor") || Item.IsInGroup("Actuator"))
{
Log.Informational("Requesting presence subscription.",
Item.BareJid);
this.xmppClient.RequestPresenceSubscription(
Item.BareJid);
}
}
Read now
Unlock full access