O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reacting to revoked presence subscriptions

If one of your contacts cancels your presence subscription, you need to reorganize yourself as well, since you will no longer be able to communicate properly with that device. You should treat this case in the same way as if the roster item was removed. Any other changes might be caused by changes in the remote device. So, to make sure, you should re-subscribe to its sensor data, if it's a sensor, to make sure you continue to get information from it:

private void XmppClient_OnRosterItemUpdated(object Sender, RosterItem Item) { bool IsSensor; Log.Informational("Roster item updated.", Item.BareJid); if (((IsSensor = (this.sensorJid != null && string.Compare(Item.BareJid,this.sensorJid,true)==0)) || ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required