From 7e8045893259702c427d1cfc667b88fb8dbbfc98 Mon Sep 17 00:00:00 2001 From: liris Date: Fri, 25 Apr 2014 12:26:00 +0900 Subject: [PATCH] - refs #80 - keep backword compatibility. --- websocket/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/websocket/__init__.py b/websocket/__init__.py index 7893c7d..3c821ee 100644 --- a/websocket/__init__.py +++ b/websocket/__init__.py @@ -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: