add test
This commit is contained in:
parent
5492b22f68
commit
28fc9e0e65
|
|
@ -22,16 +22,16 @@ async def websocket_endpoint(
|
|||
await manager.connect(websocket)
|
||||
logger.info("ws开始连接....")
|
||||
logger.info("websocket client ip==>{} port===>{}".format(websocket.client.host, websocket.client.port))
|
||||
message = {"disk_info": await get_disk_info(), "sys_info": await get_sys_info(),
|
||||
"cpu_info": await get_cpu_info(), "memory_info": await ge_mem_info()}
|
||||
try:
|
||||
while True:
|
||||
message = {"disk_info": await get_disk_info(), "sys_info": await get_sys_info(),
|
||||
"cpu_info": await get_cpu_info(), "memory_info": await ge_mem_info()}
|
||||
try:
|
||||
data = await asyncio.wait_for(websocket.receive_text(), 3)
|
||||
await asyncio.wait_for(websocket.receive_text(), 3)
|
||||
await manager.send_json(message, websocket)
|
||||
except asyncio.TimeoutError:
|
||||
logger.info("开始推送数据.......")
|
||||
print("推送数据......", message)
|
||||
await manager.send_json(message, websocket)
|
||||
except (WebSocketDisconnect, RuntimeError,):
|
||||
except (WebSocketDisconnect, RuntimeError):
|
||||
logger.info("ws开始关闭连接.....")
|
||||
manager.disconnect(websocket)
|
||||
|
|
|
|||
Loading…
Reference in New Issue