import asyncio import websockets async def t(): try: async with websockets.connect("ws://127.0.0.1:5000/ws/test") as ws: msg = await ws.recv() print(f"RECEIVED: {msg}") except Exception as e: print(f"ERROR: {e}") if __name__ == '__main__': asyncio.run(t())