Commit 9f7b6c86 authored by Taddeüs Kroes's avatar Taddeüs Kroes

WebSocket.send_close() now also sends reason in payload

parent b79247e4
......@@ -151,7 +151,10 @@ class WebSocket(object):
return thread
def send_close(self, code, reason):
payload = '' if code is None else struct.pack('!H', code)
"""
Send a close control frame.
"""
payload = '' if code is None else struct.pack('!H', code) + reason
self.send_frame(ControlFrame(OPCODE_CLOSE, payload))
self.close_frame_sent = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment