0

I have an issue delivering messages in chat when one of the users goes "offline". When 1-on-1 chat is initialized and two users are chatting, messages are being delivered and everything works great, but when app of one of the users goes background, the other one keeps messaging. It looks like messages are being sent, saved into history and cache (I log it), but when the other users goes back online and retrieves history — these messages do not appear.

In the logs I see them coming with the delay after the app restarts:

2013-03-13 01:14:42.983 MyApp[2314:1103]
QBChat/xmppStreamDidReceiveMessage: 
<message   xmlns="jabber:client" id="0" type="chat" from="XXXXX-XXXX@chat.quickblox.com"
to="XXXXXX-XXXX@chat.quickblox.com">
<body>I try again</body>
<delay xmlns="urn:xmpp:delay" from="chat.quickblox.com" stamp="2013-03-13T07:58:14.455+0000">

Entire messaging process is built using code from SimpleSample chat (Also, I do not use Push Notifications yet).

Can you, please, advise me something on this issue?

Thank you.

UPDATE: After reinstalling the app, message history with the user isn't retrieved, that means, I guess, the history I was talking about was stored in cache. Seems like I have issues in retrieving history from server. I have tried 'message.delayed = 1' in 'ChatDidReceiveMessage', but it didn't help.

1 Answers1

1

You have to logout from Chat when you go to background and login again when you go to foreground.

Your messages will be received OK in this case

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • Thank you! Could you, please, tell me something about chat history that wasn't retrieved after I erased and rebuilt the app on device? – user2137346 Mar 14 '13 at 16:02
  • Please read about chat history management here http://quickblox.com/developers/SimpleSample-chat_users-ios#Manage_Chat_History – Rubycon Mar 14 '13 at 16:49
  • @IgorKhomenko : I tried a very simple use case, I sent Message to a User who is already logged out, Now when that user logs in He/She should receive message that was sent, but He didn't received that Message. I am using QuickBlox and tried this thing with Sample provided with QuickBlox SDK. Is there any idea on this. – Mrug Apr 28 '15 at 05:57