aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_cable/connection')
-rw-r--r--lib/action_cable/connection/base.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb
index 8eec9d2a82..65e85ed114 100644
--- a/lib/action_cable/connection/base.rb
+++ b/lib/action_cable/connection/base.rb
@@ -44,10 +44,7 @@ module ActionCable
@websocket.on(:close) do |event|
logger.info "[ActionCable] #{finished_request_message}"
- worker_pool.async.invoke(self, :cleanup_subscriptions)
- worker_pool.async.invoke(self, :cleanup_internal_redis_subscriptions)
- worker_pool.async.invoke(self, :disconnect) if respond_to?(:disconnect)
-
+ worker_pool.async.invoke(self, :close_client_connection)
EventMachine.cancel_timer(@ping_timer) if @ping_timer
end
@@ -98,6 +95,12 @@ module ActionCable
worker_pool.async.invoke(self, :received_data, @pending_messages.shift) until @pending_messages.empty?
end
+ def close_client_connection
+ cleanup_subscriptions
+ cleanup_internal_redis_subscriptions
+ disconnect if respond_to?(:disconnect)
+ end
+
def broadcast_ping_timestamp
broadcast({ identifier: '_ping', message: Time.now.to_i }.to_json)
end