-
Notifications
You must be signed in to change notification settings - Fork 415
MSC2666: Get rooms in common with another user #2666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: old_master
Are you sure you want to change the base?
Changes from 25 commits
c61790e
4264f32
008951f
29f02ed
2b75da8
630af1c
d885bcf
5254076
3f2faef
db99583
10a2df2
d3b17e6
4ac7ce8
a4f5bae
c453704
cd173d5
1a389f9
fbbb2d9
591d3e5
a1de65f
d59d051
6a4e523
b946cc3
ea49670
6f4f01b
60ae94f
7829c3b
92aef5b
d58d0a1
d0c4cd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,115 @@ | ||||||
| # MSC 2666: Get rooms in common with another user | ||||||
anoadragon453 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| It is useful to be able to fetch rooms you have in common with another user. Popular messaging | ||||||
| services such as Telegram offer users the ability to show "groups in common", which allows users to | ||||||
| determine what they have in common before participating in conversation. | ||||||
|
|
||||||
| There are a variety of applications for this information. Some users may want to block invites from | ||||||
| users they do not share a room with at the client level, and need a way to poll the homeserver for | ||||||
| this information. Another use case would be trying to determine how a user came across your MXID, as | ||||||
| invites on their own do not present much context. With this endpoint, a client could tell you what | ||||||
| rooms you have in common before you accept an invite. | ||||||
|
|
||||||
| While this information can be determined if the user has full access to member state for all rooms, | ||||||
| modern clients often implement | ||||||
| [lazy-loading of room members](https://spec.matrix.org/v1.3/client-server-api/#lazy-loading-room-members), | ||||||
| so they often only have a subset of state for the rooms the user is in. Therefore, the homeserver | ||||||
| should have a means to provide this information. | ||||||
|
|
||||||
| This proposal aims to implement a simple mechanism to fetch rooms you have in common with another | ||||||
| user. | ||||||
|
|
||||||
| ## Proposal | ||||||
|
|
||||||
| Homeservers will implement a new endpoint `/_matrix/client/v1/user/mutual_rooms`. | ||||||
|
|
||||||
| This endpoint will take a query parameter of `user_id` which will contain the MXID of the user | ||||||
| matched against. | ||||||
Half-Shot marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| This endpoint can be rate limited. | ||||||
|
||||||
| This endpoint can be rate limited. | |
| This endpoint can be rate limited and requires authentication. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/res #4035
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the behaviour on invalid user IDs left as an implementation decision? (I think that's fine if so, but best to say so explicitly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC that would fall under some 400 Bad Request semantics, implementation-specific, yeah.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this example includes a trailing /, which is inconsistent with the definition above.
In general Matrix does not allow extra /s in endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's an error from a previous change that moved path-element parameters to query parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/res #4035
turt2live marked this conversation as resolved.
Show resolved
Hide resolved
anoadragon453 marked this conversation as resolved.
Show resolved
Hide resolved
clokep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere we need the words "this batch_token is only valid for use with this endpoint", and the semantics for expiration (does the homeserver need to remember the batch token forever?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an expiration time of 10 minutes could be reasonable here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case we should specify an error case for clients supplying an unknown / expired batch token, so that they can retry.
We can't use M_UNKNOWN_TOKEN - as this error would also be returned if the user used an unknown access/refresh token to access this endpoint.
We may need to define a new errcode - perhaps M_UNKNOWN_PAGINATION_TOKEN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the 10 minute timer, and added text that it will handle expired tokens the same as invalid tokens, so that implementations may forget those tokens entirely. Do you think this is a good method?
Then the clients' default response to "invalid token" is just to start over, without any token.
The only problem i see is that clients may loop on a broken implementation, where it is not passing the right token back to the server will cause it to get stuck in its mechanism where it continually retries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just leave the validity period up to the implementation, but recommend at least 10 minutes. Clients should be prepared to handle tokens that do have a ridiculously short window though.
I would also recommend clients limit the maximum number of retries before giving up, precisely to prevent infinite loops as you describe.
anoadragon453 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a strong opinion here, but 422 is pretty obscure (and we don't use it anywhere else in matrix, afaik).
The idea in Matrix is that we shouldn't rely too heavily on HTTP response codes, to make it easier (one day) to move to alternative transports. So if we need to distinguish this from other error cases, we'd do that via a custom errcode rather than HTTP response code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ftr, CoAP doesn't have code 4.22 or anything semantically similar to HTTP's 422, and there don't seem to be subsequent RFCs addressing that (while 429, e.g., has got its CoAP equivalent in a later RFC).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this sounds like programmer error vs. something that would actually need to be explicitly handled in practice. So this could just be a 400 / M_UNKNOWN - "you cannot request rooms in common with yourself".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the error to 400 + M_UNKNOWN
/res #4035
Uh oh!
There was an error while loading. Please reload this page.