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

Dispatch events when channel subscriptions are created and destroyed. #238

Closed
wants to merge 1 commit into from

Conversation

joekaram
Copy link
Contributor

@joekaram joekaram commented Aug 5, 2024

This PR adds two events:

  1. User subscribing to channel
  2. User unsubscribing from channel

@taylorotwell
Copy link
Member

Please provide an explanation of what this feature could be used for.

@joekaram
Copy link
Contributor Author

joekaram commented Aug 5, 2024

I have a use case, discussion, in which I would like to have the channels that have active connections, accessible from other processes.

I tried creating a Redis channel manager, that implements ChannelManager and ChannelConnectionManager contracts:

  • Implementing ChannelManager was complicated as the Redis client is executing asynchronously and returning promises. Using React\Async\await(...) breaks on the destructor when Reverb dispatches other jobs (e.g: PruneStaleConnections) due to the error Cannot switch fibers in destructor..
  • Implementing ChannelConnectionManager wouldn't work cause connections can't be serialized and stored in Redis.

Therefore, I added the two events so I can listen to them and manage a copy of those connections, outside of the framework, to serve my purpose.

If there's any other suggestion or way to achieve this, would really appreciate it!!

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.

2 participants