Gossip protocol for webxdc updates

Currently Delta Chat sends WebXDC updates only once, when WebXDC app generates it. Updates are also resent if the original sender of the WebXDC instance clicks on the message and selects “resend”, but this requires manual action. If WebXDC update is lost during transfer, some members may not receive it at all.

Even if no messages are lost, there is a race condition between resending a WebXDC message so new member can receive and getting an update:

  1. Alice creates a group with Bob.
  2. Alice sends a text editor WebXDC into the group.
  3. Bob sends an editor update.
  4. Alice adds Carol to the group.
  5. Alice resends an editor, but without update from Bob, because Alice has not received it yet.
  6. Alice receives an update from Bob.
  7. Carol receives editor from Alice.
  8. Now Carol has an editor, but will never receive an update from Bob.

To solve this problem devices should use some sort of gossip protocol, also known as epidemic protocol, resending each update until they get it back enough times, to increase the chance that everyone eventually receives each message.

Most WebXDC applications cannot handle lost messages properly, CRDT libraries like Yjs don’t guarantee anything in case some updates are lost. The state may never converge, editor may get stuck in a single state etc.

2 Likes