Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for сlosing message formatting #289

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/mocking_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions ws4py/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
Loading