matrix-org / matrix-spec

The Matrix protocol specification
Apache License 2.0
188 stars 94 forks source link

Ability to cancel to-device msgs #958

Open ara4n opened 2 years ago

ara4n commented 2 years ago

Both matrix-org/matrix-spec-proposals#3401 and E2EE performance would benefit from the ability to cancel to-device messages sent to a user once they have been acknowledged somehow from a single device.

For matrix-org/matrix-spec-proposals#3401, this would allow irrelevant call invites to be dropped on other devices once a call has been answered on one device. For E2EE this could radically speed up sync time after a gap on a given client, as we could ditch megolm keys sent to a given device if we know we have stored them in online backup (and then the other devices could fish them out of backup instead).

ara4n commented 2 years ago

@kegsay points out that a better approach might simply be to specify an optional timeout on to-device messages, so the client doesn't need to hang around to explicitly cancel them once they are no longer relevant.

We'd still need a way to cancel irrelevant call invites to other devices though - could be done by clobbering rather than cancelling though (e.g. a m.call.select_answer would clobber an m.call.invite).