user3829444
user3829444

Reputation: 35

Can someone explain how this ActionCable code works?

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

Upvotes: 0

Views: 57

Answers (0)

Related Questions