Closed aniciom closed 5 years ago
Read state is only stored for channel members; non-members can still use mark_read to keep the read state (ie. a livestream chat).
Is the user added as a member in your case?
Ah no its not
It seems to be working as expected now, Thanks.
Hello, i'm having an issue the situation is the next, i have a frontend chat using react and a backend server to handle the list of channels and their unread messages per client, the problem what i'm facing its the next:
1 - I go to my chat i click on the channel's box then i send using the client something like:
2 - I get a list from my backend of my channels using this code on nodejs (i'm using the client server-side):
3 - The first time i do markRead from the frontend and then i do a channel list from the backend and get all the channels data, i get 0 from countUnread and the channel.state.read seems to be filled with the right information.
Now the problem is once i restart my node server, this information seems to get lost and the state.read's object comes empty from the endpoint when i do the list channels's call, so i've to do a markRead again from the frontend and then the state.read's object gets filled with the right information, and the countUnread value is set to 0, any clue about this behaviour ? I also tried using markRead server side and the result is the same.
It seems each time the StreamChat's object gets instantiated it lost the reference to the last read's object, i don't know if its a normal or a flaw, but the thing is i can't automatically read all the messages for the user at startup time, the user should be able to know which ones were read and which ones weren't, and should be able to markRead some channels and some channels not, and i can't rely only in 1 instance because the server may get restarted and then i should mark read all them again. I hope the problem is clear, otherwise it pushes me to do some extra work in my side, grabbing all the channels and keep updating their latest messages into a local db with an unread counter.
Thanks in advance.