Save Carbon messages XMPPFramework iOS

2019-06-12 07:36发布

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.

标签: ios swift xmpp
0条回答
登录 后发表回答