matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

When state says you've left ongoing call, rejoin

Open AndrewFerr opened this issue 1 year ago • 1 comments

When receiving a state change that says you are no longer a member of a RTC session that you are actually still participating in, send another state event to put yourself back in the session membership.

This can happen when an administrator overwrites your call membership event (which is allowed even with MSC3757's restrictions on state), or if your delayed disconnection event (via MSC4140) timed out before your client could send a heartbeat to delay it further.

Signed-off-by: Andrew Ferrazzutti [email protected]

Checklist

  • [ ] Tests written for new code (and old code if feasible).
  • [x] New or updated public/exported symbols have accurate TSDoc documentation.
  • [x] Linter and other CI checks pass.
  • [x] Sign-off given on the changes (see CONTRIBUTING.md).

AndrewFerr avatar Aug 08 '24 19:08 AndrewFerr

Marking as draft until test coverage is added.

Local testing is also hitting some strange behaviour.

AndrewFerr avatar Oct 17 '24 20:10 AndrewFerr

This doesn't yet fully work in widget mode + Element Web (and potentially other clients). EW terminates the widget when it detects that there are no members left in a call. So, if there's only one person left in a call and their membership is lost (such as by a missed heartbeat), EW will close the widget before EC has a chance to restore the membership.

A naive solution could be to make EW simply wait a few seconds for an "empty" session to become non-empty. Ideally it could examine Livekit state (if that's even possible).

But EW does need to know when a call is empty, because AFAICT that's how it clears the entry in the room preview bar.

AndrewFerr avatar Nov 07 '24 21:11 AndrewFerr

I've made this depend on https://github.com/matrix-org/matrix-js-sdk/pull/4494 because without it, attempts to restore membership state are likely to get rate-limited.

AndrewFerr avatar Nov 07 '24 21:11 AndrewFerr

Albeit not fully working for embedded mode, this is still a step in the right direction IMO.

AndrewFerr avatar Nov 11 '24 07:11 AndrewFerr