You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am relying on the imperative API to subscribe to the channels channel?.subscribe(eventName, ...). I am trying to control the lifecycle of my application so as soon as there are no more subscriptions on a given channel, I want to detach it. The problem is that channel.listeners() when called without the eventName parameter does not return the listeners which are not "any" listeners. This seems counter intuitive. Additionally, knowing how many subscriptions are there for a given channel is very useful to control attaching/detaching of channels.
Are there alternative ways of knowing how many subscriptions are there without having to track all possible events to which users may have subscribed to?
Thank you very much for raising this. I agree that the channel.listeners() method contract can be a bit confusing. We don't want to change the implementation right now because it will introduce breaking changes, and other clients may rely on the current implementation. We will think about adding a new method, something like channel.allListeners(), with the behavior you desire. This improvement in our high priority list and we'll keep you posted.
Meanwhile, I can only suggest you add your own listener counter that will be responsible for calculating active listeners for the channel.
I am relying on the imperative API to subscribe to the channels
channel?.subscribe(eventName, ...)
. I am trying to control the lifecycle of my application so as soon as there are no more subscriptions on a given channel, I want to detach it. The problem is thatchannel.listeners()
when called without theeventName
parameter does not return the listeners which are not "any" listeners. This seems counter intuitive. Additionally, knowing how many subscriptions are there for a given channel is very useful to control attaching/detaching of channels.Are there alternative ways of knowing how many subscriptions are there without having to track all possible events to which users may have subscribed to?
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: