How to determine the message status (read/unread). Chat is realized with the XMPP protocol.
相关问题
- Xcode debugger displays incorrect values for varia
- Image loads in simulator but not device?
- importing files from other directories in xcode
- XCode Server: Opening import file for module '
- create tableview inside tableviewcell using swift
相关文章
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Popover segue to static cell UITableView causes co
- “Storyboard.storyboard” could not be opened
- didBeginContact:(SKPhysicsContact *)contact not in
-
The file “
.app” couldn’t be opened becaus - How do I set compatible devices to only ARKit comp
XEP-0184: Message Delivery Receipts supports notifying senders when their message has been delivered. You might be able to use that as a building block, as long as you don't expect existing clients to send these receipts -- the XEP is not widely-implemented today.
I think you need to use the Displayed Chat Marker, per http://xmpp.org/extensions/xep-0333.html
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 code while making connection
I solved this problem by adding '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.
This is just the basic idea, you could use it as per your requirement.
Hope it Helps!!
Xmpp does not have a read/unread receipt. While received is something that was implemented in XEP-0184.