Presence subscription
Presence subscription is the name given to the mechanism that allows control over how entity presence information is made available to other entities. By default, the availability of an entity is unknown to other entities.
Let’s put this into more concrete terms. For example, let’s assume that you and I are both Jabber users. I’m registered with the Jabber server running at jabber.org, my JID is qmacro@jabber.org, and you are registered with a Jabber server running at your company, and your JID is you@yourserver.com.
If you want to know whether I’m available, you have to
subscribe to my presence
.
This is done by sending a
<presence/>
packet to me with the type
attribute set
to subscribe
. In the example that follows, the XML
fragments are sent and received from your perspective:
SEND: <presence type='subscribe' to='qmacro@jabber.org'/>
I receive the <presence/>
packet, and when I receive it, it’s been stamped (by your Jabber
server) with a from
attribute with the
value you@yourserver.com. So, based upon
who it is, I decide to accept the subscription request and send back
a reply, which you receive:
RECV: <presence type='subscribed' from='qmacro@jabber.org/home' to='you@yourserver.com/work'/>
This lets you know that I’ve accepted your subscription request. From
now on, every time my availability changes (when I send a
<presence/>
packet or
when I disconnect and the server generates an unavailable
<presence/>
packet on my behalf), that availability information ...
Get Programming Jabber now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.