Search code examples
ruby-on-railsredisactioncable

Cannot retrieve active ActionCable channels


I am building a notification relay into our Rails app and having difficulty returning the active channels. I have read other questions that state using Redis.new.pubsub("channels", "action_cable/*") will return the pub/sub channels but I always receive an empty array. I have been using redis-cli monitor to see that there is communication and everything in the rails app is working fine, I just cannot return the active pub/sub channels.

I am working in development mode and have updated my cable.yml file as below:

default: &default
adapter: redis
url: redis://localhost:6379/1

development:
  <<: *default

test:
  <<: *default

production:
  <<: *default

Redis is showing the connection is made and the channels are created:

Redis Monitor Output

When I try to query the pub/subs I get the empty array:

enter image description here

Rails 5.2.2.1, Ruby 2.6.2, Redis 4.0.9


Solution

  • I was able to retrieve my channels by using Redis.new.pubsub("channels", "notification_*") instead of Redis.new.pubsub("channels", "action_cable/*").

    rails console returning correct channels