Sha256: fa423e9220a7cc1af0f3cf933141e42b4a830ebaf73560b0266ecbed40bf6d3a

Contents?: true

Size: 788 Bytes

Versions: 3

Compression:

Stored size: 788 Bytes

Contents

module ActionCable
  module Channel
    class Base
      def subscribe_to_channel
        ActiveSupport::Notifications.instrument('subscribe.action_cable', notification_payload('subscribe')) do
          run_callbacks :subscribe do
            subscribed
          end

          reject_subscription if subscription_rejected?
          ensure_confirmation_sent
        end
      end

      def unsubscribe_from_channel
        ActiveSupport::Notifications.instrument('unsubscribe.action_cable', notification_payload('unsubscribe')) do
          run_callbacks :unsubscribe do
            unsubscribed
          end
        end
      end

      private

      def notification_payload(method_name)
        { channel_class: self.class.name, action: method_name }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lograge-0.11.2 lib/lograge/rails_ext/action_cable/channel/base.rb
lograge-0.11.1 lib/lograge/rails_ext/action_cable/channel/base.rb
lograge-0.11.0 lib/lograge/rails_ext/action_cable/channel/base.rb