@@ -33,14 +33,36 @@ no feedback on delivery status.
3333There is only a "best effort" approach.
3434Messengers will typically queue messages and attempt delivery repeatedly.
3535
36- If you want guarantees for peers receiving updates,
37- you need to implement your own reliability protocol in your app.
38- Common techniques include assigning sequence numbers or linked IDs to all updates you send,
39- and implementing a way for receivers to request re-sending if updates are missing.
36+ Applications should assume that updates
37+ may be reordered and some updates may be lost.
4038
39+ For small documents, like a shopping list,
40+ it is appropriate to send the whole
41+ document state as an update each time
42+ and merge incoming documents on reception.
43+ This way changes can only be lost
44+ if original sender fails to deliver
45+ update to anyone else in the chat
46+ and stops using the app.
47+
48+ For documents consisting of independent parts,
49+ like spreadsheet consisting of cells,
50+ similar approach can be applied
51+ independently to each part.
52+
53+ For some applications
54+ like games updating the scoreboard
55+ it is fine to send new high scores
56+ as individual update,
57+ because if some update is lost
58+ it is not critical.
59+
60+ If you have complex documents and have
61+ to optimize for the size of updates
62+ by encoding the difference between the document states,
63+ you have to implement a synchronization protocol yourself.
4164As with all "network synchronization" topics there are some theoretical limits.
4265In particular it is useful to study and think about
4366the [ Two-Generals problem] ( https://en.wikipedia.org/wiki/Two_Generals'_Problem )
4467and learn about existing "reliability layer" protocols
45- before attempting to implement one yourself.
46-
68+ before attempting to implement one yourself.
0 commit comments