0

My app supports multiple devices to the user for login, So I need to implement message synchronization. Currently, I am getting messages from sender to multiple devices(Receiver)

Let me take two users to explain. User A logged in from two devices and user B logged in from one device. When user B send message to the user A then both device of user A getting messages, when user A sends message to user B from one device than another device of user A also getting carbon message in func xmppMessageCarbons(_ xmppMessageCarbons: XMPPMessageCarbons, didReceive message: XMPPMessage, outgoing isOutgoing: Bool) .

I implemented as per below:

var xmppMessageCarbons: XMPPMessageCarbons?
xmppMessageCarbons = XMPPMessageCarbons(dispatchQueue: DispatchQueue.main)
xmppMessageCarbons?.activate(xmppStream!)
xmppMessageCarbons?.autoEnableMessageCarbons = true;
xmppMessageCarbons?.addDelegate(self, delegateQueue: DispatchQueue.main)

When user A sends message from one device, I am able to get that message in func xmppMessageCarbons(_ xmppMessageCarbons: XMPPMessageCarbons, didReceive message: XMPPMessage, outgoing isOutgoing: Bool) method. Now issue is XMPPFramework not storing this carbon message in XMPPRosterCoreDataStorage so as for result I am not able to show that message on the device. I searched a lot on StackOverflow and googled to store that carbon message but nothing found helpful.

And I faced one other issue also when one of two devices of user A goes in offline then that device is not able to retrieve all offline messages as another device is online but I want to get that offline messages for the offline device.

please help me if anyone knows, thanks in advance and sorry for my bad English.

sohan vanani
  • 1,537
  • 1
  • 20
  • 37
  • Probably you have figured it out by now, still in case you are struggling with offline message retrieval, then xep-0313 for message archival and retrieval should be helpful. – divsingh Feb 28 '18 at 12:08
  • @divsingh hello thanks for the reply. Still I don’t found any proper solution and after that I left, I want to do this functionality again please help me – sohan vanani Feb 28 '18 at 12:28
  • which xmpp server are you using or planning to use? – divsingh Feb 28 '18 at 12:33
  • @divsingh i am using openfire – sohan vanani Feb 28 '18 at 12:39
  • openfire has support for xep-0313. you can start with https://stackoverflow.com/questions/11397172/xmppframework-retrieve-archived-messages-from-openfire-server – divsingh Feb 28 '18 at 12:58
  • @divsingh okay I think I tried this but problem was at storing that messages via xmppframework which I used for iOS. – sohan vanani Feb 28 '18 at 13:06

0 Answers0