Sha256: 134ebb14304418228fe42104a8147789b921c76c3e6b8ba49c7bf6d55b665018

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

# frozen_string_literal: true

module Lograge
  module ActionCable
    module ConnectionInstrumentation
      def handle_open
        ActiveSupport::Notifications.instrument('connect.action_cable', notification_payload('connect')) { super }
      end

      def handle_close
        ActiveSupport::Notifications.instrument('disconnect.action_cable', notification_payload('disconnect')) { super }
      end

      def notification_payload(method_name)
        { connection_class: self.class.name, action: method_name, data: request.params }
      end
    end
  end
end

ActionCable::Connection::Base.prepend(Lograge::ActionCable::ConnectionInstrumentation)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lograge-0.14.0 lib/lograge/rails_ext/action_cable/connection/base.rb
lograge-0.13.0 lib/lograge/rails_ext/action_cable/connection/base.rb
lograge-0.12.0 lib/lograge/rails_ext/action_cable/connection/base.rb