You need to load the messages initially using the previous message list query to fetch the messages in the channel. After you load the messages, you would then implement the onMessageReceived()event handler to receive messages to the channel while the user is online.
Hi @Ian and thanks for the reply. I have actually just done exactly that, and it seems to be working great! The only question I have, that I might actually know the answer for already, is how do you know how many messages the user missed while they were offline so that you can add that as the limit parameter? What I was about to look into as a solution for this is
but I haven’t tested it yet and wonder if there is something I need to do to mark the messages as read when they are received in order for this to work. Thanks again for your guidance.
To provide some additional context on my question. I am maintaining a local message cache on device so that I don’t have to make a server request every time a user opens a chat window and also so they are able to view their message history when they are offline. I’m loading the message history from this cache initially and then want to update it with missed messages only when the user comes back online.