matrix-org / matrix-org/matrix-js-sdk

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

Open
#1,509 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

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: https://github.com/vector-im/element-web/issues/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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the guest-access rules in matrix-doc/specification/modules/guest_access.rst, then inspect MatrixClient.prototype.sendTyping, sendReceipt, and _sendCompleteEvent in src/client.js. Compare the requested guest operations with the endpoints allowed by the specification and determine which behavior is supported. Done means the SDK's guest behavior matches the documented guest endpoints and the relevant operations are verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.