Sha256: abfe7c7d26e8cae5e05c983ef8bde64beb8891dfee03a93f204ec75b55bd1f03

Contents?: true

Size: 869 Bytes

Versions: 19

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

# :markup: markdown

module ActionCable
  module SubscriptionAdapter
    class Inline < Base # :nodoc:
      def initialize(*)
        super
        @subscriber_map = nil
      end

      def broadcast(channel, payload)
        subscriber_map.broadcast(channel, payload)
      end

      def subscribe(channel, callback, success_callback = nil)
        subscriber_map.add_subscriber(channel, callback, success_callback)
      end

      def unsubscribe(channel, callback)
        subscriber_map.remove_subscriber(channel, callback)
      end

      def shutdown
        # nothing to do
      end

      private
        def subscriber_map
          @subscriber_map || @server.mutex.synchronize { @subscriber_map ||= new_subscriber_map }
        end

        def new_subscriber_map
          SubscriberMap.new
        end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
actioncable-8.0.0 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.2 lib/action_cable/subscription_adapter/inline.rb
actioncable-8.0.0.rc2 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.1.2 lib/action_cable/subscription_adapter/inline.rb
actioncable-8.0.0.rc1 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.1.1 lib/action_cable/subscription_adapter/inline.rb
actioncable-8.0.0.beta1 lib/action_cable/subscription_adapter/inline.rb
omg-actioncable-8.0.0.alpha9 lib/action_cable/subscription_adapter/inline.rb
omg-actioncable-8.0.0.alpha8 lib/action_cable/subscription_adapter/inline.rb
omg-actioncable-8.0.0.alpha7 lib/action_cable/subscription_adapter/inline.rb
omg-actioncable-8.0.0.alpha4 lib/action_cable/subscription_adapter/inline.rb
omg-actioncable-8.0.0.alpha3 lib/action_cable/subscription_adapter/inline.rb
omg-actioncable-8.0.0.alpha2 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.1 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.0 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.0.rc1 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.0.beta3 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.0.beta2 lib/action_cable/subscription_adapter/inline.rb
actioncable-7.2.0.beta1 lib/action_cable/subscription_adapter/inline.rb