Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech debt: Update method used to get recent calls list #1608

Open
dbkr opened this issue Sep 26, 2023 · 2 comments
Open

Tech debt: Update method used to get recent calls list #1608

dbkr opened this issue Sep 26, 2023 · 2 comments
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks

Comments

@dbkr
Copy link
Member

dbkr commented Sep 26, 2023

Your use case

We currently still fetch the recent calls list using the old GroupCall class. We should update it to something more MatrixRTC-y, although the semantics are room that has an m.call event (ie. that has the state event to say it has a call ongoing). This concept doesn't exist now, so the semantics will need to change slightly.

Ideas we have:

  • Just make it show all your rooms
  • Show rooms that have any call member events in (ie. ones that a call has ever taken place in)
  • Mark our rooms as video rooms and show all video rooms
  • Mark them in some way in account data like DM rooms

Since you can only join calls in the SPA anyway, and can't use your regular account, there's no practical difference as it stands currently. This would only affect things once we allowed federation / had people logging in with accounts used for things other than EC.

Have you considered any alternatives?

No response

Additional context

No response

@dbkr dbkr added T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements T-Task Refactoring, enabling or disabling functionality, other engineering tasks and removed T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements labels Sep 26, 2023
@dbkr
Copy link
Member Author

dbkr commented Sep 26, 2023

Also we should filter to rooms with known keys

@toger5
Copy link
Contributor

toger5 commented Oct 5, 2023

I could see that the following helpers for the room list could be very helpful:

  • get_rooms_with_active_matrixRTC(application_type: String = undefined) returns a list of all rooms where we have a membership with the desired (or any) application type.
  • room.get_active_matrixRTC_session(application_type: String = undefined) returns a session summary for the room {events:[memberEventsPartOfThisSession], start: Time, participants:[User], ... participant_graph:[{time:Time, participants:[User]}]}
  • get_rooms_with_matrixRTC() returns all rooms that have membership events.
  • room.get_matrixRTC_member_events(application_type: String = undefined, limit: int, pagination_token) returns a list of the latest member events by paginating the messages endpoint with m.call.member events for all state_keys and optionally filters them.
  • room.get_matrixRTC_member_events_by_member_session(application_type: String = undefined) -> [{application_type: String, member: User, member_events:[m.call.member_event] builds up on room.get_matrixRTC_member_events and groups the events into session objects (session:{application_type, member_events}) Member events that belong to the same session are evaluated by the following algorithm:
    • calculate livefime interval of each membership state: interval.start = origin_server_ts, interval.end = next_event.origin_server_ts ?? undefined
    • Filter by active and inactive event: active := memberships != [], inactive := memberships == []
    • Group by application_type -> by_type: [{aplication_type: String, events:[(memberEvent, interval)]}]
    • Group events inby_type by state_key username and find sessions by using the interval: events[n-1].interval.end == events[n].interval.start -> events[n-1], events[n] belong to the same session. -> {application_type:String, member_sessions:[{application_type: String, member_session_interval: Interval, user: String, events:[]}]}
  • room.get_matrixRTC_sessions(application_type: String = undefined) Using get_matrixRTC_member_events_by_session,
    • Find all of the member_session elements that belong to the same session (overlapping interval):

      member_session_interval[m].start < member_session_interval[n].start < member_session_interval[m].end || member_session_interval[m].start < member_session_interval[n].end < member_session_interval[m].end for all 0<n,m<member_sessions.len()

    • Calculate overall data for the collection of member events: participants, duration, start_time, end_time, first_participant, last_participant, membership_graph: [{time:Number, memberships:[username]}]... (numerous fields can be imagined. Other fields will be easy to calculate using the collection of mebership events)

The functions build up on each other and we could start with only the first one: room.get_matrixRTC_member_events. They all need to support pagination tokens. For the list of all recent calls one would first get all rooms of interest (get_rooms_with_matrixRTC(appliaction_type: "m.call")) and then get all most recent sessions for each room. Then the room with the youngest (comparing all rooms) oldest event (oldest event in one room) will be paginated again to maybe get missing call sessions. Until the list of recent calls is filled entirely. If the user scrolls down we can again paginate the youngest oldest room.

This very much also makes sense to do server side at some point in time. Basically just cache and calculate: room.get_matrixRTC_sessions on the homeserver since otherwise each client would need to run the same algorithm for a room.

This basically is the same as Daves initial post but sumarizes more concrete functions with the hope, that we can decide what exactly we need for the userexperience we aim for and how much effort the desired part would be while providing a long term plan to query matrixRTC related data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

No branches or pull requests

2 participants