Skip to content

Commit

Permalink
Fixed assembly of websocket messages (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgve authored Jan 12, 2025
1 parent 2739270 commit 376dd56
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions steam/core/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ def _reader_loop(self):
return

logger.debug("Received {} bytes".format(len(data)))
self._readbuf += data
self.ws.receive_data(self._readbuf)
self._readbuf = b''
self.ws.receive_data(data)
self._handle_events()

def _handle_events(self):
Expand All @@ -249,7 +247,11 @@ def _handle_events(self):
logger.debug("Received websocket text message of length: {}".format(len(event.data)))
elif isinstance(event, wsevents.BytesMessage):
logger.debug("Received websocket bytes message of length: {}".format(len(event.data)))
self.recv_queue.put(event.data)
self._readbuf += event.data
if event.message_finished:
self.recv_queue.put(self._readbuf)
self._readbuf = b''

elif isinstance(event, wsevents.Pong):
logger.debug("Received pong: {}".format(repr(event.payload)))
elif isinstance(event, wsevents.CloseConnection):
Expand Down

0 comments on commit 376dd56

Please sign in to comment.