This commit is contained in:
yumoqing 2025-08-18 13:13:58 +08:00
parent 36f809a6c3
commit d1eaafa42b

View File

@ -24,7 +24,7 @@ class XtermProcessor(PythonScriptProcessor):
async def ws_2_process(self, ws):
async for msg in ws:
if msg.type == aiohttp.WSMsgType.TEXT:
# debug(f'recv from ws:{msg}.................')
debug(f'recv from ws:{msg}.................')
data = DictObject(**json.loads(msg.data))
if data.type == 'input':
self.p_obj.stdin.write(data.data)
@ -49,6 +49,7 @@ class XtermProcessor(PythonScriptProcessor):
try:
while self.running:
x = await self.p_obj.stdout.read(1024)
debug(f'{x=}')
await self.ws_send_data(ws, x)
await asyncio.sleep(0)
finally:
@ -84,6 +85,7 @@ class XtermProcessor(PythonScriptProcessor):
r1 = self.ws_2_process(ws)
r2 = self.process_2_ws(ws)
await asyncio.gather(r1,r2)
debug(f'run_xterm() ended')
async def ws_send_heartbeat(self, ws):
dic = {