3

I want to get receiver's presence (online/offline). I am using XMPPFramework and Openfire server for sending chat. But when app is killed, XMPP does not persist connection and hence user goes offline. So, I wish to send push notification to the offline user.

// If user is online

NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:chatWithUser];
[message addChild:body];
[self.xmppStream sendElement:message];

// Else when user is offline
// Method for push notification

How can I get the presence of the receiver?

Keith OYS
  • 2,285
  • 5
  • 32
  • 38
TasZ
  • 167
  • 11
  • if user is offline than also message send as offline message (that message saved in queue in openfire server ) whenever user is online that queue message send to the user .... – Mitul Bhadeshiya Apr 24 '14 at 13:03
  • 1
    ya thats right but i want to send push notification so for that i want to check if user is offline send chat via push notification else using xmpp – TasZ Apr 24 '14 at 13:30
  • You shouldn't handle that in your iphone client. This should be handled in an Openfire plugin that deals with offline messages. If the other user is offline, besides storing the message to the database, the plugin should send a push notification. – Matías R Apr 24 '14 at 15:06
  • @TasnimZ did you manage to do that, I might get benefited by your experience. Please share. – rptwsthi Mar 29 '15 at 00:33

0 Answers0