Methods
- A
- B
- I
- N
- R
Class Public methods
new()
Link
Instance Public methods
add_channel(channel, on_success)
Link
add_subscriber(channel, subscriber, on_success)
Link
# File actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb, line 11 def add_subscriber(channel, subscriber, on_success) @sync.synchronize do new_channel = !@subscribers.key?(channel) @subscribers[channel] << subscriber if new_channel add_channel channel, on_success elsif on_success on_success.call end end end
broadcast(channel, message)
Link
# 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
invoke_callback(callback, message)
Link
remove_channel(channel)
Link
remove_subscriber(channel, subscriber)
Link
# File actioncable/lib/action_cable/subscription_adapter/subscriber_map.rb, line 25 def remove_subscriber(channel, subscriber) @sync.synchronize do @subscribers[channel].delete(subscriber) if @subscribers[channel].empty? @subscribers.delete channel remove_channel channel end end end