From cf007ee4fe67ad598e680689cb487fc7a33e197f Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Sat, 27 Sep 2025 12:06:25 +0200 Subject: [PATCH] Add connection check to cli_sender --- cli_sender.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli_sender.py b/cli_sender.py index 6260785..90da285 100755 --- a/cli_sender.py +++ b/cli_sender.py @@ -6,13 +6,16 @@ import asyncio from argparse import ArgumentParser +from websockets.asyncio.client import ClientConnection from websockets.asyncio.client import connect async def run(host: str, port: int): + ws: ClientConnection async with connect(f"ws://{host}:{port}") as ws: while True: inp = input("> ") + await (await ws.ping()) # check connection await ws.send(inp)