Usecase for a observing a chat conversation #279
Unanswered
OrhanTozan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say I have a chat API. It has two functions:
suspend fun getAllMessagesOfConversations(conversationId: Int): List<Message>
fun incomingMessagesOfConversation(conversationId: Int): Flow<Message>
Now I want to abstract this and put it behind a Store, with a Source of Truth and in-memory etc. all the good stuff. I want a
Flow<List<Message>>
that represents all the messages of conversation, updated when a new incoming message was added.What would be the way to implement this?
This is my implementation suggestion:
However, does this mean that it will refetch the entire conversation, everytime I'm streaming with StoreRequest.cached()?
Beta Was this translation helpful? Give feedback.
All reactions