Skip to content

Conversation

toger5
Copy link
Contributor

@toger5 toger5 commented Sep 23, 2025

Depends on #5028

This PR adds support for sticky events in the MatrixRTCSession:

  • send sticky events instead of state events
  • update the call memberships based on sticky events instead of membership changes.
  • resend the current membership if the sticky event times out with an updated expiration ts (This is not the final solution. the sticky event timeout in iteself is enough. no expiration needed on the event content)

@toger5 toger5 changed the title Toger5/sticky-events Sticky Events support for matrixRTC (MSC4354) Sep 23, 2025
@toger5 toger5 force-pushed the toger5/sticky-events branch 2 times, most recently from 4ff6fb9 to dde4abb Compare September 23, 2025 17:57
@toger5 toger5 changed the base branch from voip-team/multi-SFU to develop September 23, 2025 17:57
@kegsay kegsay self-requested a review September 24, 2025 13:00
Copy link
Contributor Author

@toger5 toger5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temp review

Comment on lines 233 to 237
interface SessionMembershipsForRoomOpts {
listenForStickyEvents: boolean;
listenForMemberStateEvents: boolean;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we really want to make this configurable?
It would be great if we can just always make it listen to this?
Not sure its possible however...
Do you have an idea for a case where "always on" would break?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can do both at the same time? Or does it fall back to state on some trigger?
If this is temporary, it might be worth a comment to kill state as soon as event/sticky is deployed enough?

}

this.client.on(ClientEvent.Room, this.onRoom);
this.client.on(ClientEvent.Event, this.onEvent);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this in combination with:
this.roomSubset.on(RoomEvent.StickyEvents, this.onStickyEventUpdate);
will result in two calls to recalculateSessionMembers once via refreshRoom -> onRTCSessionMemberUpdate -> recalculateSessionMembers And a second time throughonStickyEventUpdate->`recalculateSessionMembers.

Or is there any check so one of them gets ignored?

A possible solution would be to check if the associated room already has a session (in onRoom) and if so, we do not call refresh room? So it only gets called on creating a new session?

This logic maybe should be applied to all of this file. refreshRoom should be: refreshSessionStore/Map and than we expect the session itself to listen to all the evnt updates. Listeners in the SessionManager only are responsible to find out if new sessions need to be created!

@Half-Shot Half-Shot mentioned this pull request Oct 1, 2025
4 tasks
@Half-Shot Half-Shot force-pushed the toger5/sticky-events branch from 34be9c8 to e3157e6 Compare October 3, 2025 12:51
@toger5
Copy link
Contributor Author

toger5 commented Oct 7, 2025

I am relativly sure we are doing the right thing.
But I want to write down (and get confirmation) that we do expire call memberships if the sticky duration times out

  • Once a sticky event expires we emit the sticky map change action
  • if that action is emitted we recalculate the room
  • public static sessionMembershipsForSlot will get called as a consequence
  • this method will compute all the memberships based on the CURRENT SET OF matrix sticky events? (so if some event times out, it will not be in the CURRENT SET OF matrix sticky and hence will not be aprt of the memberships anymore?

@toger5 toger5 changed the title Sticky Events support for matrixRTC (MSC4354) [MatrixRTC] Sticky Events support (MSC4354) Oct 7, 2025
Base automatically changed from hs/sticky-events to develop October 7, 2025 17:40
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

@toger5 toger5 marked this pull request as ready for review October 9, 2025 15:57
Signed-off-by: Timo K <[email protected]>
[M_BEACON.name]: MBeaconEventContent;
[M_POLL_START.name]: PollStartEventContent;
[M_POLL_END.name]: PollEndEventContent;
[EventType.RTCMembership]: RtcMembershipData | { msc4354_sticky_key?: string };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a TODO to try to use UnstableValue here too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should in a separate PR, yea. I'll open one to track it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted as #5042

* Default: `false`.
* @deprecated does nothing anymore we always default to the new membership manager.
*/
useNewMembershipManager?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just deleting it since it did nothing. A bit cheeky but might as well drop it.

Comment on lines 233 to 237
interface SessionMembershipsForRoomOpts {
listenForStickyEvents: boolean;
listenForMemberStateEvents: boolean;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can do both at the same time? Or does it fall back to state on some trigger?
If this is temporary, it might be worth a comment to kill state as soon as event/sticky is deployed enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants