import asyncio from websockets.asyncio.client import connect import websockets async def init(): uri = "ws://192.168.6.101:3003" async with connect(uri) as websocket: await websocket.send("speaker/2") while True: try: await websocket.recv() except websockets.ConnectionClosed: print(f"Terminated by server") break if __name__ == "__main__": asyncio.run(init())