Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message ID is 0 #13

Closed
JPMallow opened this issue Mar 6, 2014 · 3 comments
Closed

Message ID is 0 #13

JPMallow opened this issue Mar 6, 2014 · 3 comments

Comments

@JPMallow
Copy link

JPMallow commented Mar 6, 2014

Hi,

I am using Quickblox as backend for my iOS app.
I am integrating Quickblox chat in this app.
I need chat history also. So i tried this approach "http://quickblox.com/developers/Chat/1:1_Chat_history"

In that while receiving new message from another user, the message (QBChatMessage) ID is showing as always 0.

I faced the scenario like, User is in logged out state from chat. Another user is sending one or more messages to the current user. So once the current user logged in, the new messages will be coming from both chat delegate 'chatDidReceiveMessage:' and also in history query. To avoid duplicates i am overwriting those messages in already exists messages. So i need a primary key for messages from custom objects as well as chat. How to handle this scenario?

Any help would be much appreciated.

@soulfly
Copy link
Contributor

soulfly commented Mar 6, 2014

Try to use 'date_sent' field and request only messages from history where 'date_sent' > last message's date from 'chatDidReceiveMessage'

@JPMallow
Copy link
Author

JPMallow commented Mar 7, 2014

We are already using 'date_sent' to fetch the history. But the problem is, suppose we send a request to fetch history records > 'date_sent'. But before we receive the response, we receive a new message through 'chatDidReceiveMessage'. In this scenario, the same message will be delivered through both history response and 'chatDidReceiveMessage'.

In this scenario, we will not know the last 'date_sent', as we may keep on get messages through 'chatDidReceiveMessage'.

If we get either message ID (Which should be equivalent to custom object ID) for each message or total new message count in socket, we can handle this scenario in our app.

@soulfly
Copy link
Contributor

soulfly commented Aug 28, 2014

QuickBlox releases Chat 2.0 which supports message history out of the box. Check new iOS Chat message http://quickblox.com/developers/SimpleSample-chat_users-ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants