|
| 1 | +# MSC4367: `via` routes in the published room directory |
| 2 | + |
| 3 | +The [published room directory] allows clients to discover rooms on their own or other homeservers. |
| 4 | +Naturally, clients will want to join rooms found in the directory which requires knowledge of a |
| 5 | +resident server to facilitate the join. The spec doesn't make it clear how to find such a server, |
| 6 | +however. |
| 7 | + |
| 8 | +To begin with, it is unclear whether the endpoints for listing a server's directory may return rooms |
| 9 | +that the server is not joined to. Additionally, there is no recommendation on what `via` parameter |
| 10 | +clients should use when attempting to join rooms found in the directory. As a result, clients can |
| 11 | +end up browsing published rooms without being able to join them.[^1] |
| 12 | + |
| 13 | +This proposal addresses the situation by adding `via` values in the room directory responses. |
| 14 | + |
| 15 | +## Proposal |
| 16 | + |
| 17 | +A new required property `via` is added on the `PublishedRoomsChunk` returned by |
| 18 | + |
| 19 | +- [`GET /_matrix/client/v3/publicRooms`] |
| 20 | +- [`POST /_matrix/client/v3/publicRooms`] |
| 21 | +- [`GET /_matrix/federation/v1/publicRooms`] |
| 22 | +- [`POST /_matrix/federation/v1/publicRooms`] |
| 23 | + |
| 24 | +``` json5 |
| 25 | +{ |
| 26 | + "chunk": [ |
| 27 | + { |
| 28 | + "avatar_url": "mxc://bleecker.street/CHEDDARandBRIE", |
| 29 | + "room_id": "!ol19s:bleecker.street", |
| 30 | + "via": [ "bleecker.street" ], |
| 31 | + ... |
| 32 | + } |
| 33 | + ] |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Servers MUST populate `via` with at least one resident server of the room or, if they cannot |
| 38 | +determine any, omit the room from their response. |
| 39 | + |
| 40 | +Clients SHOULD include the values provided in `via` when subsequently joining rooms with |
| 41 | +[`POST /_matrix/client/v3/join/{roomIdOrAlias}`]. |
| 42 | + |
| 43 | +Together, the changes above increase the chances that clients can actually join rooms found in the |
| 44 | +directory. |
| 45 | + |
| 46 | +## Potential issues |
| 47 | + |
| 48 | +None. |
| 49 | + |
| 50 | +## Alternatives |
| 51 | + |
| 52 | +[MSC4366] deals with the same problem by forbidding unroutable rooms from the local directory. This |
| 53 | +is only a partial solution, however. |
| 54 | + |
| 55 | +## Security considerations |
| 56 | + |
| 57 | +None. |
| 58 | + |
| 59 | +## Unstable prefix |
| 60 | + |
| 61 | +While this MSC is not considered stable, `via` should be referred to as `org.matrix.msc4367.via`. |
| 62 | + |
| 63 | +## Dependencies |
| 64 | + |
| 65 | +None. |
| 66 | + |
| 67 | +[^1]: These issues were initially raised in <https://github.com/matrix-org/matrix-spec/issues/1375>. |
| 68 | + |
| 69 | + [published room directory]: https://spec.matrix.org/v1.16/client-server-api/#published-room-directory |
| 70 | + [`GET /_matrix/client/v3/publicRooms`]: https://spec.matrix.org/v1.16/client-server-api/#get_matrixclientv3publicrooms |
| 71 | + [`POST /_matrix/client/v3/publicRooms`]: https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3publicrooms |
| 72 | + [`GET /_matrix/federation/v1/publicRooms`]: https://spec.matrix.org/v1.16/server-server-api/#get_matrixfederationv1publicrooms |
| 73 | + [`POST /_matrix/federation/v1/publicRooms`]: https://spec.matrix.org/v1.16/server-server-api/#post_matrixfederationv1publicrooms |
| 74 | + [`POST /_matrix/client/v3/join/{roomIdOrAlias}`]: https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3joinroomidoralias |
| 75 | + [MSC4366]: https://github.com/matrix-org/matrix-spec-proposals/pull/4366 |
0 commit comments