Module: ActionCable::Connection::InternalChannel
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveSupport::Concern
|
|
Defined in: | actioncable/lib/action_cable/connection/internal_channel.rb |
Overview
Action Cable InternalChannel
Makes it possible for the RemoteConnection to disconnect a specific connection.
Class Method Summary
::ActiveSupport::Concern
- Extended
class_methods | Define class methods from given block. |
included | Evaluate given block in context of base class, so that you can write class macros here. |
prepended | Evaluate given block in context of base class, so that you can write class macros here. |
append_features, prepend_features |
Instance Method Summary
- #internal_channel private
- #process_internal_message(message) private
- #subscribe_to_internal_channel private
- #unsubscribe_from_internal_channel private
Instance Method Details
#internal_channel (private)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/internal_channel.rb', line 15
def internal_channel "action_cable/#{connection_identifier}" end
#process_internal_message(message) (private)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/internal_channel.rb', line 36
def ( ) case ["type"] when "disconnect" logger.info "Removing connection (#{connection_identifier})" close(reason: ActionCable::INTERNAL[:disconnect_reasons][:remote], reconnect: .fetch("reconnect", true)) end rescue Exception => e logger.error "There was an exception - #{e.class}(#{e.})" logger.error e.backtrace.join("\n") close end
#subscribe_to_internal_channel (private)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/internal_channel.rb', line 19
def subscribe_to_internal_channel if connection_identifier.present? callback = -> ( ) { decode( ) } @_internal_subscriptions ||= [] @_internal_subscriptions << [ internal_channel, callback ] server.event_loop.post { pubsub.subscribe(internal_channel, callback) } logger.info "Registered connection (#{connection_identifier})" end end
#unsubscribe_from_internal_channel (private)
[ GitHub ]# File 'actioncable/lib/action_cable/connection/internal_channel.rb', line 30
def unsubscribe_from_internal_channel if @_internal_subscriptions.present? @_internal_subscriptions.each { |channel, callback| server.event_loop.post { pubsub.unsubscribe(channel, callback) } } end end