TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/matrix-org/matrix-js-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Room class is the central model for a Matrix room. It holds the room’s live timeline, member list, threads, tags, and current state. You obtain Room instances from the MatrixClient:
Constructor
Properties
The immutable ID of this room, e.g.
!cURbafjkfsMDVwdRDQ:matrix.org.The human-readable display name for this room.
The un-homoglyphed version of the room name, used for sorting and searching.
Dict of room tags; keys are the tag name and values are optional tag metadata.
The state of the room at the time of the most recent event in the live timeline.
The room summary, populated from
/sync responses. Contains hero member info
and joined/invited member counts.Per-room account data events keyed by event type.
The live event timeline for this room, oldest event at index 0.
Methods
getMembers()
getJoinedMembers()
join.
getMember(userId)
null if the
member is not found.
getLiveTimeline()
EventTimeline for this room. Do not hold a long-lived
reference to the returned object — it may be replaced by the SDK when a timeline gap
is detected in /sync.
getThread(eventId)
Thread instance associated with the given thread-root event ID,
or null if no such thread is currently known.
getThreads()
Thread instances known to this room. This is not a
complete list of every thread that exists on the server — only threads that have been
loaded locally.
findEventById(eventId)
undefined if the event is not found in any loaded timeline.
getMembersWithMembership(membership)
KnownMembership.
getMyMembership()
leave if
not yet determined.
getJoinedMemberCount()
RoomState.
RoomEvent Enum
Events emitted byRoom instances. Listen via room.on(RoomEvent.X, handler) or
client.on(RoomEvent.X, handler).
| Value | String | Description |
|---|---|---|
RoomEvent.MyMembership | "Room.myMembership" | The local user’s membership changed. |
RoomEvent.Tags | "Room.tags" | The room’s tags were updated. |
RoomEvent.AccountData | "Room.accountData" | Per-room account data was updated. |
RoomEvent.Receipt | "Room.receipt" | A read receipt was received. |
RoomEvent.Name | "Room.name" | The room display name changed. |
RoomEvent.Redaction | "Room.redaction" | An event in the room was redacted. |
RoomEvent.RedactionCancelled | "Room.redactionCancelled" | A pending local redaction was cancelled. |
RoomEvent.LocalEchoUpdated | "Room.localEchoUpdated" | The status of a sent event changed. |
RoomEvent.Timeline | "Room.timeline" | A new event was added to the timeline. |
RoomEvent.TimelineReset | "Room.timelineReset" | The timeline was reset (e.g. after a gap). |
RoomEvent.TimelineRefresh | "Room.TimelineRefresh" | A filtered timeline set was refreshed. |
RoomEvent.OldStateUpdated | "Room.OldStateUpdated" | The room’s historical state was updated. |
RoomEvent.CurrentStateUpdated | "Room.CurrentStateUpdated" | The room’s current state was updated. |
RoomEvent.UnreadNotifications | "Room.UnreadNotifications" | Unread notification counts changed. |
RoomEvent.Summary | "Room.Summary" | A new room summary arrived from /sync. |
Thread Support
Rooms can contain threads — sub-conversations anchored to a root event. Threads are represented by theThread class and are keyed by the root event’s ID.