import asyncio import websockets import json async def test_ws_client(): uri = "ws://127.0.0.1:5005/ws/echo" try: async with websockets.connect(uri) as ws: print('Connected to echo WS') await ws.send(json.dumps({"test": 1})) print('Received:', await ws.recv()) except Exception as e: print(f'Error during test: {e}') if __name__ == '__main__': asyncio.run(test_ws_client())