Class: Upkeep::Rails::Cable::Channel

Inherits:
ActionCable::Channel::Base
  • Object
show all
Defined in:
lib/upkeep/rails/cable/channel.rb

Constant Summary collapse

SUBSCRIBE_NOTIFICATION =
"subscribe_channel.upkeep"

Instance Method Summary collapse

Instance Method Details

#subscribedObject



12
13
14
15
16
17
18
# File 'lib/upkeep/rails/cable/channel.rb', line 12

def subscribed
  if ActiveSupport::Notifications.notifier.listening?(SUBSCRIBE_NOTIFICATION)
    instrumented_subscribe
  else
    subscribe_without_instrumentation
  end
end

#unsubscribedObject



20
21
22
23
24
# File 'lib/upkeep/rails/cable/channel.rb', line 20

def unsubscribed
  Upkeep::Rails.subscriptions.unregister(subscription_id)
rescue KeyError, ActiveRecord::RecordNotFound
  nil
end