Module: ActionCable::Connection::Callbacks

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Callbacks
Included in:
Base
Defined in:
actioncable/lib/action_cable/connection/callbacks.rb

Overview

Action Cable Connection Callbacks

There are before_command, after_command, and around_command callbacks available to be invoked before, after or around every command received by a client respectively. The term “command” here refers to any interaction received by a client (subscribing, unsubscribing or performing actions):

module ApplicationCable
  class Connection < ActionCable::Connection::Base
    identified_by :user

    around_command :set_current_account

    private

    def 
      # Now all channels could use Current.account
      Current.set(account: user.) { yield }
    end
  end
end

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from ActiveSupport::Callbacks

ActiveSupport::Callbacks::CALLBACK_FILTER_TYPES

Method Summary

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Methods included from ActiveSupport::Callbacks

#run_callbacks