diff options
Diffstat (limited to 'actioncable/lib/action_cable/connection/subscriptions.rb')
-rw-r--r-- | actioncable/lib/action_cable/connection/subscriptions.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb index ccac802332..00511aead5 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -26,12 +26,14 @@ module ActionCable 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.registered! + subscriptions[id_key] = subscription + subscription.subscribe_to_channel else logger.error "Subscription class not found: #{id_options[:channel].inspect}" end |