1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actioncable/lib/action_cable/subscription_adapter/channel_prefix.rb
2017-07-23 23:30:29 +03:00

28 lines
718 B
Ruby

# frozen_string_literal: true
module ActionCable
module SubscriptionAdapter
module ChannelPrefix # :nodoc:
def broadcast(channel, payload)
channel = channel_with_prefix(channel)
super
end
def subscribe(channel, callback, success_callback = nil)
channel = channel_with_prefix(channel)
super
end
def unsubscribe(channel, callback)
channel = channel_with_prefix(channel)
super
end
private
# Returns the channel name, including channel_prefix specified in cable.yml
def channel_with_prefix(channel)
[@server.config.cable[:channel_prefix], channel].compact.join(":")
end
end
end
end