Skip to content
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

User Typing indicator API #332

Merged
merged 3 commits into from
Oct 16, 2020
Merged

User Typing indicator API #332

merged 3 commits into from
Oct 16, 2020

Conversation

shiqimei
Copy link
Contributor

@shiqimei shiqimei commented Oct 13, 2020

What? β›΅

Added a new type indicator API:

typing(options: ITypingOptions): Promise<() => Promise<void>>;

Why? πŸ€”

Closes #330
Closes #303

Links 🌎

RFC: https://forums.rocket.chat/t/rfc-30-apps-engine-add-support-for-user-typing-indicator/8684 (private)

PS πŸ‘€

@shiqimei
Copy link
Contributor Author

Implementation in the RocketChat side: RocketChat/Rocket.Chat#19228

@RocketChat RocketChat deleted a comment from codecov bot Oct 13, 2020
Copy link
Member

@d-gubert d-gubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good overall!

One thing I'm thinking is that we may leave the "setTimeout pattern" for the public API, but keep the bridge simply passing data around. This would mean having the bridge method receive the options saying whether the user is still typing, and having the Notifier accessor make the return cancellation-function in the typing method.

The reason for this is that we keep communication between the Engine and Rocket.Chat transferring simple data types (strings, objects, maybe even Buffers) instead of a complex construct like a function or an instance of a specific class, which hold more than simple data. Think about how you can't reliably serialize a function in order to transfer it over the network, if it was necessary.

@thassiov @sampaiodiego would like your opinions here too :)

@thassiov
Copy link
Contributor

I agree. Passing functions around can make it a bit more difficult to reason about the functionality, too (at least in my head it does). But it works, so πŸ‘

@codecov
Copy link

codecov bot commented Oct 16, 2020

Codecov Report

Merging #332 into alpha will decrease coverage by 2.06%.
The diff coverage is 12.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##            alpha     #332      +/-   ##
==========================================
- Coverage   52.76%   50.69%   -2.07%     
==========================================
  Files          83       75       -8     
  Lines        2968     2858     -110     
  Branches      433      436       +3     
==========================================
- Hits         1566     1449     -117     
- Misses       1402     1409       +7     
Impacted Files Coverage Ξ”
src/server/accessors/Notifier.ts 56.00% <12.50%> (-20.48%) ⬇️
src/server/marketplace/license/index.ts
src/server/storage/index.ts
src/server/bridges/index.ts
src/server/managers/index.ts
src/server/errors/index.ts
src/server/compiler/index.ts
src/server/accessors/index.ts
src/server/logging/index.ts

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 3ab8f57...1421563. Read the comment docs.

@shiqimei
Copy link
Contributor Author

Very good overall!

One thing I'm thinking is that we may leave the "setTimeout pattern" for the public API, but keep the bridge simply passing data around. This would mean having the bridge method receive the options saying whether the user is still typing, and having the Notifier accessor make the return cancellation-function in the typing method.

The reason for this is that we keep communication between the Engine and Rocket.Chat transferring simple data types (strings, objects, maybe even Buffers) instead of a complex construct like a function or an instance of a specific class, which hold more than simple data. Think about how you can't reliably serialize a function in order to transfer it over the network, if it was necessary.

@thassiov @sampaiodiego would like your opinions here too :)

Thanks for the inputs :) It does make sense. I've made changes, please take another review.

@d-gubert d-gubert changed the title [NEW] Type indicator User Typing indicator API Oct 16, 2020
@d-gubert d-gubert merged commit 000e42d into alpha Oct 16, 2020
@d-gubert d-gubert deleted the type-indicator branch October 16, 2020 15:46
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

Successfully merging this pull request may close these issues.

[idea] Typing event for Rocket.Chat Bot Apps Add support for User typing indicator
3 participants