From ace6a7b5e34084680cb77f83aeefd3341defb0ee Mon Sep 17 00:00:00 2001 From: Nick Pellant Date: Tue, 14 Apr 2020 18:16:07 +0100 Subject: [PATCH] Add IbClientAdapter#ib_client_connected? This method returns the status of the client. It can be used like so: ```ruby DRbObject.new_with_uri("druby://localhost:1992").ib_client_connected? ``` This is useful for liveness probes and health checks when running in a production system. --- lib/ib_ruby_proxy/server/ib_client_adapter.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ib_ruby_proxy/server/ib_client_adapter.rb b/lib/ib_ruby_proxy/server/ib_client_adapter.rb index 4b65696..c82b436 100644 --- a/lib/ib_ruby_proxy/server/ib_client_adapter.rb +++ b/lib/ib_ruby_proxy/server/ib_client_adapter.rb @@ -26,6 +26,10 @@ def initialize(ib_client, ib_wrapper_adapter) @ib_wrapper_adapter = ib_wrapper_adapter end + def ib_client_connected? + @ib_client.isConnected + end + # @param [IbRubyProxy::Client::IbCallbacksObserver] ib_callbacks_observer def add_ib_callbacks_observer(ib_callbacks_observer) ib_wrapper_adapter.add_observer(ib_callbacks_observer)