diff options
author | Maxim Devaev <[email protected]> | 2024-10-23 23:02:25 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-10-23 23:02:25 +0300 |
commit | 684b9f629e5f9c8979d5d2ecfc2384919e0482d7 (patch) | |
tree | 4e7013c0885ecafcdcc7bb6c7ef4fec4157b78ce /kvmd | |
parent | 76d70d08381f4503518eeb30b3259e57db64ed78 (diff) |
send kvmd version to ws
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/server.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index b88bc6b7..cd50678f 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -33,6 +33,8 @@ from aiohttp.web import Request from aiohttp.web import Response from aiohttp.web import WebSocketResponse +from ... import __version__ + from ...logging import get_logger from ...errors import OperationError @@ -251,7 +253,13 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins stream = valid_bool(req.query.get("stream", True)) legacy = valid_bool(req.query.get("legacy", True)) async with self._ws_session(req, stream=stream, legacy=legacy) as ws: - await ws.send_event("loop", {}) + (major, minor) = __version__.split(".") + await ws.send_event("loop", { + "version": { + "major": int(major), + "minor": int(minor), + }, + }) states = [ (event_type, src.get_state()) for sub in self.__subsystems |