This constructs a room session. When using MatrixRTC inside the js-sdk this is expected to be used with the MatrixRTCSessionManager exclusively.
In cases where you don't use the js-sdk but build on top of another Matrix stack this class can be used standalone to manage a joined MatrixRTC session.
A subset of the MatrixClient that lets the session interact with the Matrix room.
The room this session is attached to. A subset of a js-sdk Room that the session needs.
The list of memberships this session currently has.
The slot description is a virtual address where participants are allowed to meet.
This session will only manage memberships that match this slot description.
Sessions are distinct if any of those properties are distinct: roomSubset.roomId
, slotDescription.application
, slotDescription.id
.
The list of memberships this session currently has.
Readonly
slotThe slot description is a virtual address where participants are allowed to meet.
This session will only manage memberships that match this slot description.
Sessions are distinct if any of those properties are distinct: roomSubset.roomId
, slotDescription.application
, slotDescription.id
.
The statistics for this session.
WARN: this can in theory only be a subset of the room with the properties required by this class. Outside of tests this most likely will be a full room, however.
The slotId of the call.
{application}#{appSpecificId}
It can be undefined since the slotId is only known once the first membership joins.
The slotId is the property that, per definition, groups memberships into one call.
Synchronously calls each of the listeners registered for the event named
event
, in the order they were registered, passing the supplied arguments
to each.
The name of the event to emit
Arguments to pass to the listener
true
if the event had listeners, false
otherwise.
Synchronously calls each of the listeners registered for the event named
event
, in the order they were registered, passing the supplied arguments
to each.
The name of the event to emit
Arguments to pass to the listener
true
if the event had listeners, false
otherwise.
Similar to emit
but calls all listeners within a Promise.all
and returns the promise chain
The name of the event to emit
Arguments to pass to the listener
true
if the event had listeners, false
otherwise.
Similar to emit
but calls all listeners within a Promise.all
and returns the promise chain
The name of the event to emit
Arguments to pass to the listener
true
if the event had listeners, false
otherwise.
The used focusActive of the oldest membership (to find out the selection type multi-sfu or oldest membership active focus)
Get the call intent for the current call, based on what members are advertising. If one or more
members disagree on the current call intent, or nobody specifies one then undefined
is returned.
If all members that specify a call intent agree, that value is returned.
A call intent, or undefined
if no consensus or not given.
This returns the focus in use by the oldest membership. Do not use since this might be just the focus for the oldest membership. others might use a different focus.
Announces this user and device as joined to the MatrixRTC session, and continues to update the membership event to keep it valid until leaveRoomSession() is called This will not subscribe to updates: remember to call subscribe() separately if desired. This method will return immediately and the session will be joined in the background.
the list of preferred foci to use in the joined RTC membership event. If multiSfuFocus is set, this is only needed if this client wants to publish to multiple transports simultaneously.
Optional
multiSfuFocus: Transportthe active focus to use in the joined RTC membership event. Setting this implies the
membership manager will operate in a multi-SFU connection mode. If undefined
, an oldest_membership
transport selection will be used instead.
Optional
joinConfig: JoinSessionConfigAdditional configuration for the joined session.
Announces this user and device as having left the MatrixRTC session and stops scheduled updates. This will not unsubscribe from updates: remember to call unsubscribe() separately if desired. The membership update required to leave the session will retry if it fails. Without network connection the promise will never resolve. A timeout can be provided so that there is a guarantee for the promise to resolve.
Whether the membership update was attempted and did not time out.
Returns the number of listeners listening to the event named event
.
The name of the event being listened for
Adds the listener
function to the end of the listeners array for the
event named event
.
No checks are made to see if the listener
has already been added. Multiple calls
passing the same combination of event
and listener
will result in the listener
being added, and called, multiple times.
By default, event listeners are invoked in the order they are added. The prependListener method can be used as an alternative to add the event listener to the beginning of the listeners array.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Adds a one-time listener
function for the event named event
. The
next time event
is triggered, this listener is removed and then invoked.
Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The prependOnceListener method can be used as an alternative to add the event listener to the beginning of the listeners array.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Call this when something changed that may impacts the current MatrixRTC members in this session.
Adds the listener
function to the beginning of the listeners array for the
event named event
.
No checks are made to see if the listener
has already been added. Multiple calls
passing the same combination of event
and listener
will result in the listener
being added, and called, multiple times.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Adds a one-timelistener
function for the event named event
to the beginning of the listeners array.
The next time event
is triggered, this listener is removed, and then invoked.
The name of the event.
The callback function
a reference to the EventEmitter
, so that calls can be chained.
Returns a copy of the array of listeners for the event named eventName
,
including any wrappers (such as those created by .once()
).
Re-emit an EncryptionKeyChanged event for each tracked encryption key. This can be used to export the keys.
Removes all listeners, or those of the specified event
.
It is bad practice to remove listeners added elsewhere in the code,
particularly when the EventEmitter
instance was created by some other
component or module (e.g. sockets or file streams).
Optional
event: The name of the event. If undefined, all listeners everywhere are removed.
a reference to the EventEmitter
, so that calls can be chained.
Removes the specified listener
from the listener array for the event named event
.
a reference to the EventEmitter
, so that calls can be chained.
Performs cleanup & removes timers for client shutdown
Static
callReturns all the call memberships for a room that match the provided sessionDescription
,
oldest first.
Static
roomReturn the MatrixRTC session for the room. This returned session can be used to find out if there are active room call sessions for the requested room.
This method is an alias for MatrixRTCSession.sessionForRoom
with
sessionDescription { id: "", application: "m.call" }
.
Optional
opts: SessionMembershipsForRoomOptsStatic
sessionStatic
sessionReturn the MatrixRTC session for the room.
This returned session can be used to find out if there are active sessions
for the requested room and slotDescription
.
Optional
opts: SessionMembershipsForRoomOptsStatic
sessionStatic
sessionReturns all the call memberships for a room that match the provided sessionDescription
,
oldest first.
A MatrixRTCSession manages the membership & properties of a MatrixRTC session. This class doesn't deal with media at all, just membership & properties of a session.