Getting Action Cable to broadcast in Sidekiq Job

I had the same problem. Came across this answer: ActionCable.server.broadcast from the console - worked for me. Basically just changed cable.yml

development:
  adapter: async

to

development:
  adapter: redis
  url: redis://localhost:6379/1

and I was able to broadcast from console, models, Sidekiq worker classes, etc.


For those who wants to dockerize rails and sidekiq, you should run action_cable server separately like

puma -p 28080 cable/config.ru

https://nickjanetakis.com/blog/dockerize-a-rails-5-postgres-redis-sidekiq-action-cable-app-with-docker-compose

https://github.com/kchrismucheke/dockersample/blob/da5923899fb17682fabed041bef5381ed3fd91ab/config/application.rb#L57-L62