- keep backword compatibility.
This commit is contained in:
liris
2014-04-25 12:26:00 +09:00
parent 81cd2efd4f
commit 7e80458932

View File

@@ -1025,7 +1025,10 @@ class WebSocketApp(object):
elif op_code == ABNF.OPCODE_CONT and self.on_cont_message:
self._callback(self.on_cont_message, frame.data, frame.fin)
else:
self._callback(self.on_message, frame.data)
data = frame.data
if six.PY3 and frame.opcode == ABNF.OPCODE_TEXT:
data = data.decode("utf-8")
self._callback(self.on_message, data)
except Exception as e:
self._callback(self.on_error, e)
finally: