method

add

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: Subscriptions
add(data) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actioncable/lib/action_cable/connection/subscriptions.rb, line 30
      def add(data)
        id_key = data["identifier"]
        id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access

        return if subscriptions.key?(id_key)

        subscription_klass = id_options[:channel].safe_constantize

        if subscription_klass && ActionCable::Channel::Base > subscription_klass
          subscription = subscription_klass.new(connection, id_key, id_options)
          subscriptions[id_key] = subscription
          subscription.subscribe_to_channel
        else
          logger.error "Subscription class not found: #{id_options[:channel].inspect}"
        end
      end
Register or log in to add new notes.