2022-05-19 修复改用wss协议后无法使用的问题

This commit is contained in:
FedoraLinux
2022-05-19 19:12:03 +08:00
parent b120257d64
commit 99549c52fc
27 changed files with 75 additions and 8 deletions

View File

@ -1,6 +1,7 @@
import os
from protobuf import message_pb2
from protobuf import wss_pb2
import gzip
from messages.member import MemberMessage
from messages.like import LikeMessage
from messages.roomuserseq import RoomUserSeqMessage
@ -22,13 +23,16 @@ init()
def unpackMsgBin(filepath):
response = message_pb2.Response()
wss = wss_pb2.WssResponse()
try:
with open(filepath, 'rb') as f:
response.ParseFromString(f.read())
path_content = f.read()
wss.ParseFromString( path_content )
decompressed = gzip.decompress(wss.data)
response.ParseFromString(decompressed)
decodeMsg(response.messages)
except Exception as e:
os.remove(filepath)
pass
finally:
os.remove(filepath)