Skip to content

Commit a02edaf

Browse files
committed
check if push type is equal to response in WebsocketClient send method
1 parent e59cf6c commit a02edaf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

livechat/utils/ws_client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ def send(self,
8181
if not self.sock or self.sock.send(request_json, opcode) == 0:
8282
raise WebSocketConnectionClosedException(
8383
'Connection is already closed.')
84-
while not (response := next((item for item in self.messages
85-
if item.get('request_id') == request_id),
86-
None)) and response_timeout > 0:
84+
while not (response := next(
85+
(item
86+
for item in self.messages if item.get('request_id') == request_id
87+
and item.get('type') == 'response'),
88+
None)) and response_timeout > 0:
8789
sleep(0.2)
8890
response_timeout -= 0.2
8991
self.logger.info(f'\nRESPONSE:\n{json.dumps(response, indent=4)}')

0 commit comments

Comments
 (0)