i am developing chat application using xmppframework and i am successfully completed the send and receive message , but
1) if i am chat with user A and user B send me message the how can i identify the user B send me the message. (i already maintain the messages in core data so message will be saved) 2) how can i identify the received message is read or unread
NOTE : for message saving i used
xmppMessageArchivingStorage = [XMPPMessageArchivingCoreDataStorage sharedInstance];
xmppMessageArchivingModule = [[XMPPMessageArchiving alloc] initWithMessageArchivingStorage:xmppMessageArchivingStorage];
thanks
You can have look to XEP-0184
This should be the message stanza format
And This is received response message
Here
messageId-1010
will be unique to get you know which message response it is.For users who are facing the same problem.
If you want to get the read receipts then instead of sending auto message delivery receipts, send it whenever user reads that message. Each message has it's corresponding message_id. Use that message_id to send the delivery receipt for the particular message that has been read. Add following line while making connection
I have used 'chatStatus' attribute in my message entity. For sender I have kept value of chatStatus as sent, unsent, or received(received by other side or not). For Receiver Side I have kept the Values as read or unread(Have I read message or not, So that for unread message I could send read Receipts).
On Click Of send Button:
In cellForRowAtIndexPath:
And finally when you receive the delivery Receipt in didReceiveMessage, update the chatStatus to received
You could set the values of chatStatus as per your requirement. As for unsent messages I have set it as sent in didSendMessage delegate.
Note: In my app I had to just show the read, sent and unset status, not the delivered status. If you also wanna show delivery status, then don't comment autoSendMessageDeliveryReceipts and whenever messages are read send the IQ stanza to sender instead of delivery receipt and change the chatStatus accordingly.On sender side you have to take one one value for chatStatus sent, unsent, received, delivered.
Hope it Helps!!