import asyncio import websockets async def hello(): uri = "ws://192.168.137.2:6666" async with websockets.connect(uri) as websocket: while(1): name = input("input command? ") await websocket.send(name) print(f"> {name}") greeting = await websocket.recv() print(f"< {greeting}") asyncio.get_event_loop().run_until_complete(hello())