Add an implementation of MSC2762: send/receive events#9
Merged
Conversation
turt2live
added a commit
to matrix-org/matrix-react-sdk
that referenced
this pull request
Nov 3, 2020
Part of MSC2762: matrix-org/matrix-spec-proposals#2762 Requires: matrix-org/matrix-widget-api#9 This is the bare minimum required to send an event to a widget and receive events from widgets. Like the view_room action, this is controlled by a well-known permission key. **Danger**: This allows widgets to potentially modify room state. Use the permissions with care.
dbkr
reviewed
Nov 11, 2020
| return this.transport.send<ISendEventToWidgetRequestData>( | ||
| WidgetApiToWidgetAction.SendEvent, | ||
| rawEvent as ISendEventToWidgetRequestData, // it's compatible, but missing the index signature | ||
| ).then(); |
Member
Author
There was a problem hiding this comment.
It's a conversion because using async is hard and the types are a bit strong.
dbkr
approved these changes
Nov 12, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MSC: matrix-org/matrix-spec-proposals#2762
The capabilities introduced by MSC2762 are a bit annoying to parse and handle, so they spawned a utility class in this PR. The utility class just makes the code a bit clearer and easier to follow, at the risk of added complexity.
Documentation is intentionally left for a later PR. Tests would be nice, however none of the widget-api has tests at the moment :(