2
votes

I am working on a chat app using XMPP Protocol.
I tried following this tutorial from github . Everything is working fine using XMPP.

But I'm unable to receive offline messages when user comes online.
As user A is logged out and user B sends messages to user A, and when user A logs into app, it must receive all the messages that were sent by user B during offline session.

How can I receive these offline messages?
My app is totally stuck on this issue. Please help if anyone knows the solution. Any help will be appreciated. Thanks

2
Ok working.. I just added #import "XMPPMessage+XEP_0184.h" in AppDelegate and it works.Sushil Sharma
how did you do this? i Have added this class but i couldn't receive when i'm back online.Please help me to do this?falcon143
hello i am using swift code i am also stuck here can any one help to solve this issue....Akash Raghani
anyone succeeded in this ?MOHAMMAD ISHAQ
How to get offline message in push notification in mobile side instantly?Hardik Mamtora

2 Answers

0
votes

You need to enable mod_offline on server, if you are using ejabberd XMPP Server.

Here is the code needs to enable module:

ignore_pep_from_offline: true
max_user_offline_messages: 
admin: 5000
all: 100
mod_offline: 
access_max_user_messages: max_user_offline_messages

Write this code in ejabberd.yml config file.
It will store unto 100 messages per user received when client was offline.

At client side, you may have to register for service:

'http://jabber.org/protocol/disco#info'

If you done this, whenever offline client gets online, server will send those stored messages to respective client.

0
votes

You've to send Request for offline message if server supports. XMPP works on TCP protocol so as soon as client is up, it should send request to server.

<iq type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info' 
         node='http://jabber.org/protocol/offline'/>
</iq>