Method: ActionCable::SubscriptionAdapter::SubscriberMap#broadcast

Defined in:
actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb

#broadcast(channel, message) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb', line 36

def broadcast(channel, message)
  list = @sync.synchronize do
    return if !@subscribers.key?(channel)
    @subscribers[channel].dup
  end

  list.each do |subscriber|
    invoke_callback(subscriber, message)
  end
end