Sha256: ba996e4d589266818dbd4b1ee3978ed83cf5233dcbe6a3447f93823cff63fc03

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require "anycable-rails"

module ActionCable
  module SubscriptionAdapter
    # AnyCable subscription adapter delegates broadcasts
    # to AnyCable
    class AnyCable < Base
      ACTION_CABLE_SERVER_ERROR_MESSAGE = <<~STR
        Looks like you're trying to connect to Rails Action Cable server, not an AnyCable one.

        Please make sure your client is configured to connect to AnyCable server.

        See https://docs.anycable.io/troubleshooting
      STR

      def initialize(*)
      end

      def broadcast(channel, payload)
        ::AnyCable.broadcast(channel, payload)
      end

      def subscribe(*)
        raise NotImplementedError, ACTION_CABLE_SERVER_ERROR_MESSAGE
      end

      def unsubscribe(*)
        raise NotImplementedError, ACTION_CABLE_SERVER_ERROR_MESSAGE
      end

      def shutdown
        # nothing to do
        # we only need this method for development,
        # 'cause code reloading triggers `server.restart` -> `pubsub.shutdown`
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
anycable-rails-core-1.4.1 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-core-1.4.0 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.4.0 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.4.0.rc.4 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.4.0.rc.3 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.4.0.rc.2 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.4.0.rc.1 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.3.7 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.3.6 lib/action_cable/subscription_adapter/any_cable.rb
anycable-rails-1.3.5 lib/action_cable/subscription_adapter/any_cable.rb