Skip to content

Commit 129e5e9

Browse files
MSC3827: Filtering of /publicRooms by room type (#3827)
1 parent 1bfa09c commit 129e5e9

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

proposals/3827-space-explore.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# MSC3827: Filtering of `/publicRooms` by room type
2+
3+
[MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772) defines Spaces as
4+
rooms with `type` of `m.space`. One of the most requested features for Spaces is
5+
to have [a way to to discover
6+
them](https://github.com/vector-im/element-web/issues/17264). To solve this
7+
issue, this MSC proposes a mechanism for filtering the response of
8+
`/publicRooms` by room type.
9+
10+
## Proposal
11+
12+
This MSC proposes adding a `room_types` filter to the [`POST /publicRooms`](https://spec.matrix.org/v1.3/client-server-api/#post_matrixclientv3publicrooms) endpoint.
13+
The value of `room_types` is an array of room types - possible values of the
14+
`type` field in the `m.room.create` state event's `content` dictionary - which should be returned.
15+
16+
An example request could look like this:
17+
18+
```HTTP
19+
POST /_matrix/client/v3/publicRooms
20+
{
21+
"filter": {
22+
"room_types": ["m.space"]
23+
},
24+
"limit": 10
25+
}
26+
```
27+
28+
The response for both `POST /publicRooms` and `GET /publicRooms` is also modified to include a `room_type` field, so that clients can show
29+
the room type metadata.
30+
31+
```json
32+
{
33+
"chunk": [{
34+
"avatar_url": "mxc://bleecker.street/CHEDDARandBRIE",
35+
"guest_can_join": false,
36+
"join_rule": "public",
37+
"name": "CHEESE",
38+
"num_joined_members": 37,
39+
"room_id": "!ol19s:bleecker.street",
40+
"topic": "Tasty tasty cheese",
41+
"world_readable": true,
42+
"room_type": "m.space"
43+
}],
44+
"next_batch": "p190q",
45+
"prev_batch": "p1902",
46+
"total_room_count_estimate": 115
47+
}
48+
```
49+
50+
If the client wants to get rooms of the default type, it should include `null`
51+
in the `room_types` array. If the `room_types` filter is not specified or the
52+
`room_types` array is empty, the server should return _all_ rooms no matter the
53+
type.
54+
55+
## Alternatives
56+
57+
### Using a special endpoint
58+
59+
A special endpoint for spaces and other room types could be used. Then each new
60+
room type would require a special MSC and there would be no way to filter by
61+
custom room types. Filtering by multiple types would be impossible.
62+
63+
### Replacing the room directory with a server-wide space
64+
65+
[A matrix-spec issue](https://github.com/matrix-org/matrix-spec/issues/830)
66+
suggests replacing the room directory with a server-wide space; while this
67+
solution certainly has benefits, it would require a lot of changes both on the
68+
client and the server side.
69+
70+
## Unstable prefix
71+
72+
While this MSC is not considered stable, implementations should use
73+
`org.matrix.msc3827` as a namespace.
74+
75+
|Release |Development |
76+
|------------|-------------------------------|
77+
|`room_type` |`org.matrix.msc3827.room_type` |
78+
|`room_types`|`org.matrix.msc3827.room_types`|

0 commit comments

Comments
 (0)