diff --git a/example/mocking_data_source.py b/example/mocking_data_source.py index a830475..1fd7ae2 100644 --- a/example/mocking_data_source.py +++ b/example/mocking_data_source.py @@ -30,7 +30,7 @@ def recv(self, size): current_bytes = self.remaining_bytes[:size] self.remaining_bytes = self.remaining_bytes[size:] - if self.remaining_bytes is b'': + if self.remaining_bytes == b'': self.frame = None self.remaining_bytes = None diff --git a/ws4py/websocket.py b/ws4py/websocket.py index 61f8c33..6d94650 100644 --- a/ws4py/websocket.py +++ b/ws4py/websocket.py @@ -462,7 +462,7 @@ def process(self, bytes): self.reading_buffer_size = s.parser.send(bytes) or DEFAULT_READING_SIZE if s.closing is not None: - logger.debug("Closing message received (%d) '%s'" % (s.closing.code, s.closing.reason)) + logger.debug("Closing message received (%d): %s" % (s.closing.code, s.closing.reason.decode() if isinstance(s.closing.reason, bytes) else s.closing.reason)) if not self.server_terminated: self.close(s.closing.code, s.closing.reason) else: @@ -471,7 +471,7 @@ def process(self, bytes): if s.errors: for error in s.errors: - logger.debug("Error message received (%d) '%s'" % (error.code, error.reason)) + logger.debug("Error message received (%d): %s" % (error.code, error.reason.decode() if isinstance(error.reason, bytes) else error.reason)) self.close(error.code, error.reason) s.errors = [] return False