0

How to get all online consumers (publishers / subscribers) who is currently streaming on specific channel ?

Rana
  • 81
  • 1
  • 1
  • 8

1 Answers1

1

You can view the number of subscribers in rails console with

ActionCable.server.connections.length

Also, if can see who is connected if you are using redis as the adapter.

Redis.new.pubsub("channels", "action_cable/*") and to view the total number of connections.

Redis.new.pubsub("NUMPAT")

Hope this will help.

Muhammed Anees
  • 1,810
  • 1
  • 16
  • 17
  • 1
    I got empty packets when I run Redis.new.pubsub("channels", "action_cable/*") and I got this error " ERR Unknown PUBSUB subcommand or wrong number of arguments for 'NUMPAT' " when I run Redis.new.pubsub("NUMPAT", "action_cable/*") – Rana Jan 31 '18 at 10:10
  • @user3582703, are you sure you have active connections?. Also I've updated the numpat syntax. – Muhammed Anees Jan 31 '18 at 10:32
  • where can I write this command ? I want it to be written on a web page – Rana Feb 04 '18 at 14:52