Hi,
Let's say that I have a chat with 500 messages, seqs going from 1 to 500.When I first access the topic it downloads 20 messages, from 480 to 500.Now I want to go to the message with seq 150, display it alongside 20 ealier and 20 later messages. Like 130....150...170.
Also when I scroll down it should download the next 20 messages from 171(included) to 192(excluded).
Is this possible ?
I am making my own client in VueJS. So there is no logic like I need already in the sdk of the react app, right ?
There is one more details, what if a message inside the range I request was replaced by another message(edit) with seq outside of the range I am requesting ? Is there a way to know if a message was replaced ?
For example:
I have 500 seqs.
I download from 200 to 250. The message with seq 210 was replaced by the message with seq 300 then that message was replaced by a message with seq 400(the edit was edited). Now the 210 seq message will not be replaced in the list because 210 and 300 are not present.
Similar thing with replies. A message inside the seqs could be a reply to an older message or a message from the seqs could have as reply a message outiside the seq range. Message with seq 220 have the message with seq 260 as reply. They won't be displayed.
My ideea for these 2 problems would be to group edits and replies inside the parent message and not deliver them as normal messages on topic.onData.
message = {
<allready existing fields>
edits: [] //array of messages that are edits of the parent(replace)
reply: {} //message that is reply to the parent, the client app will handle the way the reply is displayed or replies: [] array with the messages that are replies to the parent
That's not what usually happens. Usually the client downloads the latest 450-500 messages, then the previous 400-450 (or whatever the page size is), etc.Also, most of the edits happen very quickly, usually within a few messages from the original.This must be the first chatting app where messages gone missing is acceptable because it's usually not a problem.
User loads first page of messages (ids 1 through 10). Message 11 is a reply to message 1. Well, too bad; that reply does not deserve to be shown.
User loads first page of messages (ids 1 through 10). Message 11 is a reply to message 1. Well, too bad; that reply does not deserve to be shown.You may want to make a better API at hand.