import asyncio import websockets async def send_commands(websocket, path): print("Client connected.") try: while True: command = input("Enter command (type 'exit' to quit): ") await websocket.send(command) if command == "exit": print("Exiting.") break response = await websocket.recv() print("Received output:") print(response) except websockets.ConnectionClosedOK: print("Client disconnected.") async def main(): server = await websockets.serve(send_commands, "localhost", 8080) await server.wait_closed() asyncio.run(main())