Skip to content

Commit ea86f96

Browse files
committed
Inform that client has closed connection
1 parent 8b943c1 commit ea86f96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

websocket.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ def read_next_message(self):
128128
OPCODE = ord(b1) & 0b00001111
129129
MASKED = ord(b2) & 0b10000000
130130
LENGTH = ord(b2) & 0b01111111
131-
131+
132+
if not b1:
133+
print("Client closed connection.")
134+
self.keep_alive = 0
135+
return
132136
if OPCODE == 8:
133137
print("Client asked to close connection.")
134138
self.keep_alive = 0

0 commit comments

Comments
 (0)