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

[DRAFT] Whispering backport for Action Cable #201

Closed

Conversation

lHydra
Copy link
Contributor

@lHydra lHydra commented Jun 9, 2024

What is the purpose of this pull request?

Add whispering backport for Action Cable

Is there anything you'd like reviewers to focus on?

@palkan Hi! Could you please take a look at the MR? Did I understand the essence of the issue correctly?

That is, we want to have the following code in our Rails application:

import consumer from "channels/consumer"

consumer.subscriptions.create("ChatChannel", {
  whisper(payload) {
    this.perform("whisper", payload);
  }
})

Which will trigger the execution of the predefined #whisper method from the channel?

Checklist

  • I've added tests for this change
  • I've added a Changelog entry
  • I've updated documentation

Closes #198

@palkan
Copy link
Member

palkan commented Jun 29, 2024

Thanks for the PR! (And sorry for later response).

predefined #whisper method from the channel?

Now, we use as custom command for whispering (so, the final JSON would be {"command":"whisper", "identifier": "...","data": <payload>}). It would be hard to achieve this functionality with @rails/actioncable; supporting AnyCable JS would be enough. Here is how channel.whisper(...) is implemented there:

Thus, we don't need a Channel #whisper method, all can be done within the Subscriptions class.

@palkan
Copy link
Member

palkan commented Sep 14, 2024

Thanks!

I've updated and merged it into #205

@palkan palkan closed this Sep 14, 2024
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.

Whispering backport for Action Cable
2 participants