Skip to content

Commit 4a9a31c

Browse files
authored
Merge pull request #156 from livechat/API-14047/fix-unhandled-warning-in-run-forever-loop
Fix unhandled warning in websocket client
2 parents abe41a9 + 080f965 commit 4a9a31c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

livechat/utils/ws_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def open(self,
6363
keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
6464
response_timeout (int or float): timeout (in seconds) to wait for the response,
6565
by default sets to 3 seconds. '''
66+
if self.sock and self.sock.connected:
67+
logger.warning(
68+
'Cannot open new websocket connection, already connected.')
69+
return
6670
self.response_timeout = response_timeout
6771
run_forever_kwargs = {
6872
'sslopt': {

0 commit comments

Comments
 (0)