Hi I am going to implement a project list with socket.io where any clients can update it.
For example, let's assume it's in such a format.
list 1
list 2
...
list 10k
A client can add a list say list 2.1, it will be stored to database and broadcast to other clients, and for efficiency we only broadcast list 2.1. The JavaScript program for all clients will insert it to the right position once receiving it, so now the list for all participants become:
list 1
list 2
list 2.1
...
list 10k
Say now, client A and client B are tentatively disconnected from internet. And list 2.2 and list 2.3 are sent by other clients, and missed by client A and client B. After that client A and client B are then brought back, and received a new list 2.4. Their list become
list 1
list 2
list 2.1
list 2.4
...
list 10k
which is incorrect (missing list 2.2 and list 2.3). How do we handle such as issue in the frontend or backend code (I am using next.js and node.js)? (One possible solution of course is by retrieving data again from database, but how do we know whether the clients missed any listing?)