Skip to content

In the spirit of matrix-doc/specification/modules/guest_access.rst, Allow Guest to sendTyping + sendReceipt + sendMessage #1509

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

Open
archywillhe opened this issue Oct 14, 2020 · 9 comments

Comments

@archywillhe
Copy link

archywillhe commented Oct 14, 2020

Is your feature request related to a problem? Please describe.
Yes. The problem is that if we want to use matrix-js-sdk to build chat/RTC applications with a more guest-centric design it is difficult unless we create an user account with password in the background for them. (There is a whole thread on this: element-hq/element-web#9264)

Describe the solution you'd like
I would like to introduce changes to the SDK to allow guest send message, as well as enable guest to send typing notification.

So maybe remove

    if (this.isGuest()) {
        return Promise.resolve({}); // guests cannot send typing notifications so don't bother.
    }

in MatrixClient.prototype.sendTyping and MatrixClient.prototype.sendReceipt in src/client.js.

And then maybe need to do something in _sendCompleteEvent,etc too?


According to https://github.com/matrix-org/matrix-doc/blob/master/specification/modules/guest_access.rst#put-matrix-client-%CLIENT_MAJOR_VERSION%-rooms-roomid-send-eventtype-txnid :

The following API endpoints are allowed to be accessed by guest accounts for sending events:

POST /rooms/:room_id/join
POST /rooms/:room_id/leave
PUT /rooms/:room_id/send/m.room.message/:txn_id
PUT /sendToDevice/{eventType}/{txnId}

So it's implemented in Matrix that guest can PUT /rooms/:room_id/send/m.room.message/:txn_id?

I have not gone through synapse's source so I can't confirm that though.

Additional context
This is my day 1 of reading matrix-js-sdk's source. So will appreaciate any pointers!

@archywillhe archywillhe changed the title Guest can sendTyping + sendReceipt + sendMessage as according to matrix-doc/specification/modules/guest_access.rst In the spirit of matrix-doc/specification/modules/guest_access.rst, Allow Guest to sendTyping + sendReceipt + sendMessage Oct 14, 2020
@archywillhe
Copy link
Author

@t3chguy
Copy link
Member

t3chguy commented Oct 14, 2020

allow guest send message

It does.

Element Web used to use this function but then started requiring registration to start chatting out of their own choice, the technology allowed it.

@archywillhe
Copy link
Author

archywillhe commented Oct 15, 2020

@t3chguy it was implemented using the ILAG approach and doesn’t go through the guest API. Read more here element-hq/element-web#9264

@t3chguy
Copy link
Member

t3chguy commented Oct 15, 2020

Yes. But before ILAG it used real guests. And even now if you have a Synapse configured to auto-join guests into a room then Element will let that guest speak. Youa re correct that typing and receipts don't work. But messages DO

@archywillhe
Copy link
Author

archywillhe commented Oct 15, 2020

Hmm I think I know what’s happening now. So the current sdk does allow for send message. But just not typing & receipt.

And in Element It is somehow designed that if you join a none-auto-join room as a guest, you won’t be able to do much. But auto-join lands you to a different GUI and you can send message.

Do you think the Matrix backend supports guest typing & receipt or it doesn’t?

@t3chguy
Copy link
Member

t3chguy commented Oct 15, 2020

This repo does not concern any GUI. It is a very low level library.

@archywillhe
Copy link
Author

@t3chguy i was talking about the matrix react library because you mentioned Element.

@t3chguy
Copy link
Member

t3chguy commented Oct 15, 2020

In Element (matrix-react-sdk), it will prevent you from joining a room as a guest. But if you are somehow in one as that guest (directly manipulating the API or Synapse auto join) then it will let you do everything a guest is technically capable of doing.

@archywillhe
Copy link
Author

archywillhe commented Oct 15, 2020

Yeah by “join a room as guest” i meant more as turning on guest_access in Synapse and visiting a room as a guest. But indeed. That is more like guest preview than guest join.

I’ve been working on a hobby project https://lo.fish and right now I’m deciding whether to rewrite my backend in Eilixir or switch to using Matrix and write my front end into a Matrix client. My project relies heavily on guest access functionality, which I felt like is not something Matrix pays a lot of attentions in. (Of course you can argue that if enough interest is generated & there will be more pull requests on this & more will be done. Also can be nice if I can contribute some code to Matrix too.)

Eventually I will open source my project (i.e. as an Elixir+react framework or as a Matrix client). Right now I’m not sure if I should invest the time in Matrix and do it the Matrix way, or go for a more flexible approach (Elixir) and have more control over the architecture (but then of course if I want to enjoy things like decentralisation and E2E I will have to do more work. So this will also change the trajectory of my project.)

@github-actions github-actions bot added the Stale label Feb 8, 2025
@RiotRobot RiotRobot removed the Stale label Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants