Open jwoertink opened 1 year ago
I remember when monitoring redis for rails actioncable, it uses an internal key as a control pubsub, so it can do some maintenance tasks (like disconnecting all connections for a give client), could take advantage of similar approach, but I'm not confident about how to use it
or maybe could use a redis key to inc/dec on conn/disconn and fetch this number? 🤔
Just for some added context here, what I'm currently doing is something like this:
class ChatChannel < Channel
def subscribe
increment_count
stream_from("room:1")
end
def unsubscribe
decrement_count
end
end
Then elsewhere I have a loop that runs every minute asking what that count is. It would be so much nicer if I could just ask the channel how many are in there, and who they are. Then I wouldn't have to store that separately.
I'm not sure if the rails one has this. I tried searching and couldn't find it, but I feel like I should have an easy way to know exactly how many connects are open on a specific channel.