Sha256: 8f027de07d529d548a3807508350d05f471912f641dae0d0cb51d63e532c8c25

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

require "action_cable/channel"

module ActionCable
  module Channel
    class Base # :nodoc:
      alias handle_subscribe subscribe_to_channel

      public :handle_subscribe, :subscription_rejected?

      def subscribe_to_channel
        # noop
      end

      def stream_from(broadcasting, callback = nil, coder: nil)
        raise ArgumentError('Unsupported') if callback.present? || coder.present? || block_given?
        connection.socket.subscribe identifier, broadcasting
      end

      def stop_all_streams
        connection.socket.unsubscribe_from_all identifier
      end

      def delegate_connection_identifiers
        connection.identifiers.each do |identifier|
          define_singleton_method(identifier) do
            connection.fetch_identifier(identifier)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
anycable-rails-0.5.2 lib/anycable/rails/actioncable/channel.rb
anycable-rails-0.5.1 lib/anycable/rails/actioncable/channel.rb
anycable-rails-0.5.0 lib/anycable/rails/actioncable/channel.rb
anycable-rails-0.5.0.rc2 lib/anycable/rails/actioncable/channel.rb
anycable-rails-0.5.0.rc1 lib/anycable/rails/actioncable/channel.rb
anycable-rails-0.4.7 lib/anycable/rails/actioncable/channel.rb