ConversationRequest and MessageRequest, how do I know if I reached the end?

Dear CometChat peeps,
Once again, thank you for your being so helpful and responsive and I really like the service so far, however I have once more bumped into a question I don’t really see an easy solution to.

Specifically: When I load conversations or message history using fetchNext, how would I know if I reached the end of the list? So, for example, I want to lazy load conversations for a user, how would I know if that user reached the end of the list and I need to stop trying to lazy load without making an additional request? Same question applies for the history.

Is my only solution to try fetchNext() and if I don’t receive any more results back and then disable my lazy load or is there a more elegant solution?

Thank you

1 Like

Hello @beez,

When the fetchNext request is made, there are two possible scenarios when you should disable the lazy load:

  1. The request returns 0 messages/conversations.
  2. The request returns messages/conversation less than the limit specified in the request.

Hope this helps!