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

Managing the roster

Apart from connecting to the XMPP network, we need a way to manage our roster, or who our friends are. In this chapter, we will use the simplest, but not safest, approach, by accepting all presence subscription requests:

private void AttachFeatures() { this.xmppClient.OnPresenceSubscribe += (Sender, e) => { Log.Informational("Accepting friendship request.", this.xmppClient.BareJID, e.From); e.Accept(); }; this.xmppClient.OnPresenceUnsubscribe += (Sender, e) => { Log.Informational("Friendship removed.", this.xmppClient.BareJID, e.From); e.Accept(); }; this.xmppClient.OnPresenceSubscribed += (Sender, e) => Log.Informational("Friendship request accepted.", this.xmppClient.BareJID, e.From); this.xmppClient.OnPresenceUnsubscribed ...

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