maybe it should fix zlib.error: Error -3 while decompressing data: invalid stored block lengths

This commit is contained in:
grey-cat-1908 2022-03-17 14:39:41 +03:00
parent 7100a3c6cb
commit 6723407f9a

View file

@ -107,6 +107,7 @@ class Gateway:
await self.ws.send_str(payload) await self.ws.send_str(payload)
async def parse_websocket_message(self, msg): async def parse_websocket_message(self, msg):
try:
if type(msg) is bytes: if type(msg) is bytes:
self._buffer.extend(msg) self._buffer.extend(msg)
@ -117,6 +118,8 @@ class Gateway:
self._buffer = bytearray() self._buffer = bytearray()
return json.loads(msg) return json.loads(msg)
except zlib.error:
return None
async def handle_data(self, data): async def handle_data(self, data):
if data['op'] == self.DISPATCH: if data['op'] == self.DISPATCH: