new events model

This commit is contained in:
Maxim Devaev
2024-10-21 17:46:59 +03:00
parent b67a232584
commit cda32a083f
30 changed files with 335 additions and 165 deletions

View File

@@ -175,17 +175,18 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
self.__kvmd_ws = None
async def __process_ws_event(self, event_type: str, event: dict) -> None:
if event_type == "info_meta_state":
try:
host = event["server"]["host"]
except Exception:
host = None
else:
if isinstance(host, str):
name = f"PiKVM: {host}"
if self._encodings.has_rename:
await self._send_rename(name)
self.__shared_params.name = name
if event_type == "info_state":
if "meta" in event:
try:
host = event["meta"]["server"]["host"]
except Exception:
host = None
else:
if isinstance(host, str):
name = f"PiKVM: {host}"
if self._encodings.has_rename:
await self._send_rename(name)
self.__shared_params.name = name
elif event_type == "hid_state":
if self._encodings.has_leds_state: