summaryrefslogtreecommitdiff
path: root/kvmd/htserver.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-04-11 16:34:07 +0300
committerMaxim Devaev <[email protected]>2022-04-11 16:34:30 +0300
commit80b5546d21cb5c67aeb4f28f339fa4a029bc88c2 (patch)
tree5db9801bcf7697e540c12d6226bfdb192c026ab7 /kvmd/htserver.py
parent6bd2b9c6809294702320c0dd5dfdfb0fbef204d7 (diff)
refactoring
Diffstat (limited to 'kvmd/htserver.py')
-rw-r--r--kvmd/htserver.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/kvmd/htserver.py b/kvmd/htserver.py
index 6196b7a1..34b38846 100644
--- a/kvmd/htserver.py
+++ b/kvmd/htserver.py
@@ -255,9 +255,12 @@ class HttpServer:
unix_path: str,
unix_rm: bool,
unix_mode: int,
+ heartbeat: float,
access_log_format: str,
) -> None:
+ self.__heartbeat = heartbeat # pylint: disable=attribute-defined-outside-init
+
if unix_rm and os.path.exists(unix_path):
os.remove(unix_path)
server_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
@@ -274,6 +277,15 @@ class HttpServer:
loop=asyncio.get_event_loop(),
)
+ # =====
+
+ async def _make_ws_response(self, request: Request) -> WebSocketResponse:
+ ws = WebSocketResponse(heartbeat=self.__heartbeat)
+ await ws.prepare(request)
+ return ws
+
+ # =====
+
async def _init_app(self, app: Application) -> None:
raise NotImplementedError
@@ -283,6 +295,8 @@ class HttpServer:
async def _on_cleanup(self, app: Application) -> None:
_ = app
+ # =====
+
async def __make_app(self) -> Application:
app = Application(middlewares=[normalize_path_middleware(
append_slash=False,