|
| 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_type` filter to the `/publicRooms` endpoint. |
| 13 | +The value of `room_type` is an array of room types - possible values of the |
| 14 | +`type` field in the `m.room.create` state event - 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_type": ["m.space"] |
| 23 | + }, |
| 24 | + "limit": 10 |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +the response then also includes 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 | + |
| 51 | +## Alternatives |
| 52 | + |
| 53 | +### Using a special endpoint |
| 54 | + |
| 55 | +A special endpoint for spaces and other room types could be used. Then each new |
| 56 | +room type would require a special MSC and there would be no way to filter by |
| 57 | +custom room types. Filtering by multiple types would be impossible. |
| 58 | + |
| 59 | +### Replacing the room directory with a server-wide space |
| 60 | + |
| 61 | +[A matrix-spec issue](https://github.com/matrix-org/matrix-spec/issues/830) |
| 62 | +suggests replacing the room directory with a server-wide space; while this |
| 63 | +solution certainly has benefits, it would require a lot of changes both on the |
| 64 | +client and the server side. |
| 65 | + |
| 66 | +## Unstable prefix |
| 67 | + |
| 68 | +While this MSC is not considered stable, implementations should use |
| 69 | +`org.matrix.msc3827` as a namespace. |
| 70 | + |
| 71 | +|Release |Development | |
| 72 | +|-----------|------------------------------| |
| 73 | +|`room_type`|`org.matrix.msc3827.room_type`| |
0 commit comments