From c9d32003cc5f5ba54573638ff5042fd86f61602e Mon Sep 17 00:00:00 2001 From: Damian Borowiecki Date: Thu, 21 Jan 2021 08:44:48 +0100 Subject: [PATCH] OAI-29: Improved connection check method --- core/websocket/abstract_websocket_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/websocket/abstract_websocket_client.py b/core/websocket/abstract_websocket_client.py index 3205fd6d..becf960f 100644 --- a/core/websocket/abstract_websocket_client.py +++ b/core/websocket/abstract_websocket_client.py @@ -66,7 +66,11 @@ def is_open(self): :return: True if connection is opened. """ - return self.websocket is not None + if not self.websocket: + return False + else: + sock = self.websocket.sock + return sock and sock.connected def add_action_on_receive(self, on_receive_func: Callable[[object], None]): """