diff --git a/ahserver/xtermProcessor.py b/ahserver/xtermProcessor.py index eab72c2..fe134e3 100644 --- a/ahserver/xtermProcessor.py +++ b/ahserver/xtermProcessor.py @@ -19,6 +19,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}') resize_pattern = '_#_resize_#_' heartbeat_pattern = '_#_heartbeat_#_' if msg.data.startswith(resize_pattern): @@ -26,7 +27,7 @@ class XtermProcessor(PythonScriptProcessor): await self.p_obj.set_terminal_size(row, col) continue if msg.data == heartbeat_pattern: - await ws_send(ws, heartbeat_pattern) + await self.ws_sendstr(ws, heartbeat_pattern) continue self.p_obj.stdin.write(msg.data) elif msg.type == aiohttp.WSMsgType.ERROR: @@ -37,6 +38,7 @@ class XtermProcessor(PythonScriptProcessor): while self.running: x = await self.p_obj.stdout.read(1024) await self.ws_sendstr(ws, x) + await asyncio.sleep(0) async def datahandle(self,request): await self.path_call(request) @@ -81,6 +83,8 @@ class XtermProcessor(PythonScriptProcessor): "type":1, "data":s } + debug(f'{data=}') await ws.send_str(json.dumps(data, indent=4, ensure_ascii=False)) + debug(f'{data=} sended')