in wsl, socketio can not handle some request?

This commit is contained in:
wataru 2023-01-09 22:18:56 +09:00
parent e6d635b2ec
commit d414b5d3a8
2 changed files with 12 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -22,12 +22,17 @@ class MMVC_Namespace(socketio.AsyncNamespace):
async def on_request_message(self, sid, msg): async def on_request_message(self, sid, msg):
timestamp = int(msg[0]) timestamp = int(msg[0])
data = msg[1] data = msg[1]
unpackedData = np.array(struct.unpack('<%sh' % (len(data) // struct.calcsize('<h')), data))
audio1 = self.voiceChangerManager.changeVoice(unpackedData)
# print("sio result:", len(audio1), audio1.shape) if(isinstance(data, str)):
bin = struct.pack('<%sh' % len(audio1), *audio1) print(type(data))
await self.emit('response', [timestamp, bin]) print(data)
await self.emit('response', [timestamp, 0])
else:
unpackedData = np.array(struct.unpack('<%sh' % (len(data) // struct.calcsize('<h')), data))
audio1 = self.voiceChangerManager.changeVoice(unpackedData)
# print("sio result:", len(audio1), audio1.shape)
bin = struct.pack('<%sh' % len(audio1), *audio1)
await self.emit('response', [timestamp, bin])
def on_disconnect(self, sid): def on_disconnect(self, sid):
# print('[{}] disconnect'.format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))) # print('[{}] disconnect'.format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))