Rails Action Cable Broadcast not working from controller but works from console


I am using Rails 7.0.5 and testing the Action Cable feature to send broadcast message using controller action. The broadcast as below works from rails console, but same if I put in controller action, the broadcast displays for 2-3 seconds on index page and then disappears.

ActionCable.server.broadcast "chat_channel", {title: 'Hello From Rails'}

Make sure that you have a Redis server up and running @Chandan1980

1 Like