Skip to content

Commit c93fac4

Browse files
authored
Update SimpleWebSocketServer.py
should send TEXT back if environment is Python2 and data is str.
1 parent 34e6def commit c93fac4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

SimpleWebSocketServer/SimpleWebSocketServer.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,7 @@ def sendMessage(self, data):
370370
If data is a unicode object then the frame is sent as Text.
371371
If the data is a bytearray object then the frame is sent as Binary.
372372
"""
373-
opcode = BINARY
374-
if _check_unicode(data):
375-
opcode = TEXT
373+
opcode = TEXT if isinstance(data, basestring if VER < 3 else str) else BINARY
376374
self._sendMessage(False, opcode, data)
377375

378376

0 commit comments

Comments
 (0)