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.

Hierarchy (view full)

Constructors

Properties

_callId: undefined | string
client: MatrixClient
encryptionKeys: Map<string, Uint8Array[]> = ...
expiryTimeout?: number
keysEventUpdateTimeout?: number
lastEncryptionKeyUpdateRequest?: number
makeNewKeyTimeout?: number
manageMediaKeys: boolean = false
memberEventTimeout?: number
membershipId: undefined | string
memberships: CallMembership[]
needCallMembershipUpdate: boolean = false
ownFociPreferred?: Focus[]
ownFocusActive?: Focus
relativeExpiry: undefined | number
room: Room
setNewKeyTimeouts: Set<number> = ...
updateCallMembershipRunning: boolean = false
useLegacyMemberEvents: boolean = true

Accessors

  • get callId(): undefined | string
  • The callId (sessionId) of the call.

    It can be undefined since the callId is only known once the first membership joins. The callId is the property that, per definition, groups memberships into one call.

    Returns undefined | string

Methods

  • A map of keys used to encrypt and decrypt (we are using a symmetric cipher) given participant's media. This also includes our own key

    Returns IterableIterator<[string, Uint8Array[]]>

  • 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.

    Parameters

    • fociPreferred: Focus[]

      The list of preferred foci this member proposes to use/knows/has access to. For the livekit case this is a list of foci generated from the homeserver well-known, the current rtc session, or optionally other room members homeserver well known.

    • Optional fociActive: Focus

      The object representing the active focus. (This depends on the focus type.)

    • Optional joinConfig: JoinSessionConfig

      Additional configuration for the joined session.

    Returns void

  • 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.

    Parameters

    • timeout: undefined | number = undefined

    Returns Promise<boolean>

  • Generate a new sender key and add it at the next available index

    Parameters

    • delayBeforeUse: boolean = false

      If true, wait for a short period before setting the key for the media encryptor to use. If false, set the key immediately.

    Returns void

  • 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).

    Parameters

    Returns this

    a reference to the EventEmitter, so that calls can be chained.

  • Requests that we resend our keys to the room. May send a keys event immediately or queue for alter if one has already been sent recently.

    Returns void

  • Sets an encryption key at a specified index for a participant. The encryption keys for the local participanmt are also stored here under the user and device ID of the local participant.

    Parameters

    • userId: string

      The user ID of the participant

    • deviceId: string

      Device ID of the participant

    • encryptionKeyIndex: number

      The index of the key to set

    • encryptionKeyString: string

      The string representation of the key to set in base64

    • delayBeforeuse: boolean = false

      If true, delay before emitting a key changed event. Useful when setting encryption keys for the local participant to allow time for the key to be distributed.

    Returns void