Can someone explain how this ActionCable code works?

29 views Asked by At

In irb ;

server = ActionCable::Server::Base.new
server.broadcast "channel", message

This all works as I would expect it to, sends a message. I am confused as to why it actually works at all. From what I am understanding, ActionCable::Server::Base includes ActionCable::Server::Broadcasting module which basically allows access to the nested class Broadcasting and from there we basically send a request to the worker pool via pubsub to run the broadcast from the available worker pool which just again schedules another worker?

https://github.com/rails/rails/blob/36c1591bcb5e0ee3084759c7f42a706fe5bb7ca7/actioncable/lib/action_cable/server/broadcasting.rb

0

There are 0 answers