提交 662c0643 编写于 作者: P Pratik Naik

Simplify client connection closing

上级 a4f96c33
......@@ -44,10 +44,7 @@ def process
@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 @@ def initialize_client
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册