-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live updates of edited and deleted messages #39
Comments
Think the what you mentioned is worth a shot. 😄
Yes you are right after confirm the message must be deleted and removed from db.
Column can be added for this, Also I need to check the database migration files so version upgrade will not affect db when update is done. I can create private github section for this and we and develop / test it there, let me know about that. Grtz |
Got all the migration in 1 file now. |
I don't know what you mean by private section. How about you create a new branch for this feature? However I suggest to wait with that because I'm currently changing a lot of the logic in the |
Close this one 😉 |
You mentioned this already in another PR. When a user edits or deletes a message, other users need to refresh the page in order for their messages to reflect these changes. It would be nice if this could be updated live for the other users.
The problem is database performance. Every time mChat refreshes, messages that have a higher ID than the ID of the user's latest message are fetched. For fetching information about deleted and edited messages, two additional queries are necessary.
For detecting deleted messages, the server needs to know the user's first and last message IDs. I see two possible solutions.
Note that I'm assuming that the existing logic of deleting messages isn't changed. Once a user deletes a message, it is removed from the database. One could design it in a way that deleting a message only sets a flag but retains the message in the database. I think this approach is unacceptable, as I'd expect a message to be irretrievably removed once the deletion is confirmed. What do you think?
For detecting edited messages, the database needs a new column
edit_time
. Every time mChat refreshes, it needs to send theedit_time
of every message. The server can then fetch those messages that have a later edit time than the user sent. This could be added to the existing query.There might be better solutions. I can go into more detail but first I was wondering if you have any comments or ideas yourself. The client-side coding is the smallest issue. 😊
The text was updated successfully, but these errors were encountered: