From df87514c7cbc202e5e469f775daea8c3bf972fff Mon Sep 17 00:00:00 2001 From: engn33r Date: Sun, 7 Mar 2021 22:07:12 -0500 Subject: Fix #639 by adding close branch for reserved custom status codes --- websocket/_core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/websocket/_core.py b/websocket/_core.py index f832cad..a3e484b 100644 --- a/websocket/_core.py +++ b/websocket/_core.py @@ -478,7 +478,9 @@ class WebSocket(object): continue if isEnabledForError(): recv_status = struct.unpack("!H", frame.data[0:2])[0] - if recv_status != STATUS_NORMAL: + if recv_status >= 3000 and recv_status <= 4999: + debug("close status: " + repr(recv_status)) + elif recv_status != STATUS_NORMAL: error("close status: " + repr(recv_status)) break except: -- cgit v1.2.1