I'm trying to implement some of the delegate methods of the XMPPStream class, one of which is xmppStream:(XMPPStream *)sender didReceivePresence:(XMPPPresence *)presence
. I have two users registered, and both are subscribed to each other's presence notifications. A thing I noticed is, the didReceivePresence
method is called only when a user authorizes. Disconnecting and/or connecting a user doesn't notify the subscriber about it. What can I do to receive the notifications when someone I'm subscribed to goes offline/online?
The code I use to send presence to the XMPPStream is:
- (void) goOnline
{
XMPPPresence *presence = [XMPPPresence presence];
[_stream sendElement:presence];
}
- (void) goOffline
{
XMPPPresence *presence = [XMPPPresence presenceWithType:@"unavailable"];
[_stream sendElement:presence];
}