Sha256: 0a838fdd02ad3da56f2f8f2b23dd9dff22576748365b3a7d43d7dbf755dd1b67

Contents?: true

Size: 731 Bytes

Versions: 3

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

# :markup: markdown

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)
          [config.cable[:channel_prefix], channel].compact.join(":")
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
actioncable-next-0.1.2 lib/action_cable/subscription_adapter/channel_prefix.rb
actioncable-next-0.1.1 lib/action_cable/subscription_adapter/channel_prefix.rb
actioncable-next-0.1.0 lib/action_cable/subscription_adapter/channel_prefix.rb