You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

114 lines
4.7 KiB

  1. ==================
  2. Room Join Workflow
  3. ==================
  4. An outline of the workflows required when a user joins a room.
  5. Discovery
  6. =========
  7. To join a room, a user has to discover the room by some mechanism in order to
  8. obtain the (opaque) Room ID and a candidate list of likely home servers that
  9. contain it.
  10. Sending an Invitation
  11. ---------------------
  12. The most direct way a user discovers the existence of a room is from a
  13. invitation from some other user who is a member of that room.
  14. The inviter's HS sets the membership status of the invitee to "invited" in the
  15. "m.members" state key by sending a state update PDU. The HS then broadcasts this
  16. PDU among the existing members in the usual way. An invitation message is also
  17. sent to the invited user, containing the Room ID and the PDU ID of this
  18. invitation state change and potentially a list of some other home servers to use
  19. to accept the invite. The user's client can then choose to display it in some
  20. way to alert the user.
  21. [[TODO(paul): At present, no API has been designed or described to actually send
  22. that invite to the invited user. Likely it will be some facet of the larger
  23. user-user API required for presence, profile management, etc...]]
  24. Directory Service
  25. -----------------
  26. Alternatively, the user may discover the channel via a directory service; either
  27. by performing a name lookup, or some kind of browse or search acitivty. However
  28. this is performed, the end result is that the user's home server requests the
  29. Room ID and candidate list from the directory service.
  30. [[TODO(paul): At present, no API has been designed or described for this
  31. directory service]]
  32. Joining
  33. =======
  34. Once the ID and home servers are obtained, the user can then actually join the
  35. room.
  36. Accepting an Invite
  37. -------------------
  38. If a user has received and accepted an invitation to join a room, the invitee's
  39. home server can now send an invite acceptance message to a chosen candidate
  40. server from the list given in the invitation, citing also the PDU ID of the
  41. invitation as "proof" of their invite. (This is required as due to late message
  42. propagation it could be the case that the acceptance is received before the
  43. invite by some servers). If this message is allowed by the candidate server, it
  44. generates a new PDU that updates the invitee's membership status to "joined",
  45. referring back to the acceptance PDU, and broadcasts that as a state change in
  46. the usual way. The newly-invited user is now a full member of the room, and
  47. state propagation proceeds as usual.
  48. Joining a Public Room
  49. ---------------------
  50. If a user has discovered the existence of a room they wish to join but does not
  51. have an active invitation, they can request to join it directly by sending a
  52. join message to a candidate server on the list provided by the directory
  53. service. As this list may be out of date, the HS should be prepared to retry
  54. other candidates if the chosen one is no longer aware of the room, because it
  55. has no users as members in it.
  56. Once a candidate server that is aware of the room has been found, it can
  57. broadcast an update PDU to add the member into the "m.members" key setting their
  58. state directly to "joined" (i.e. bypassing the two-phase invite semantics),
  59. remembering to include the new user's HS in that list.
  60. Knocking on a Semi-Public Room
  61. ------------------------------
  62. If a user requests to join a room but the join mode of the room is "knock", the
  63. join is not immediately allowed. Instead, if the user wishes to proceed, they
  64. can instead post a "knock" message, which informs other members of the room that
  65. the would-be joiner wishes to become a member and sets their membership value to
  66. "knocked". If any of them wish to accept this, they can then send an invitation
  67. in the usual way described above. Knowing that the user has already knocked and
  68. expressed an interest in joining, the invited user's home server should
  69. immediately accept that invitation on the user's behalf, and go on to join the
  70. room in the usual way.
  71. [[NOTE(Erik): Though this may confuse users who expect 'X has joined' to
  72. actually be a user initiated action, i.e. they may expect that 'X' is actually
  73. looking at synapse right now?]]
  74. [[NOTE(paul): Yes, a fair point maybe we should suggest HSes don't do that, and
  75. just offer an invite to the user as normal]]
  76. Private and Non-Existent Rooms
  77. ------------------------------
  78. If a user requests to join a room but the room is either unknown by the home
  79. server receiving the request, or is known by the join mode is "invite" and the
  80. user has not been invited, the server must respond that the room does not exist.
  81. This is to prevent leaking information about the existence and identity of
  82. private rooms.
  83. Outstanding Questions
  84. =====================
  85. * Do invitations or knocks time out and expire at some point? If so when? Time
  86. is hard in distributed systems.