mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
handle closing ws event
This commit is contained in:
@@ -153,6 +153,8 @@ class KvmdClientWs:
|
||||
msg = receive_task.result()
|
||||
if msg.type == aiohttp.WSMsgType.TEXT:
|
||||
yield json.loads(msg.data)
|
||||
elif msg.type == aiohttp.WSMsgType.CLOSE:
|
||||
await self.__ws.close()
|
||||
elif msg.type == aiohttp.WSMsgType.CLOSED:
|
||||
break
|
||||
else:
|
||||
@@ -167,6 +169,10 @@ class KvmdClientWs:
|
||||
receive_task.cancel()
|
||||
if writer_task:
|
||||
writer_task.cancel()
|
||||
try:
|
||||
await self.__ws.close()
|
||||
except Exception:
|
||||
pass
|
||||
self.__communicated = False
|
||||
|
||||
async def send_key_event(self, key: str, state: bool) -> None:
|
||||
|
||||
Reference in New Issue
Block a user