import asyncio import websockets import json async def main(): uri = "wss://ag.variet.net/ws" try: async with websockets.connect(uri) as ws: print("Connected to remote hub.") # Send AUTH first auth_msg = { "type": "auth", "token": "2352253f42bd0f9190a83c26f05cc252e86c55c044206953fa7b8fd97adaa6d3", "project": "gravity_control", "instance_number": 1, "pc_name": "TEST_PC" } await ws.send(json.dumps(auth_msg)) resp = await ws.recv() print("Auth response:", resp) # Now send pending msg = { "type": "pending", "data": { "request_id": "999999999_mock_1", "command": "MOCK COMMAND FROM TEST", "description": "If you see this, the hub is routing perfectly.", "step_type": "", "status": "pending", "buttons": [{"text": "Proceed", "index": 0}], "project_name": "gravity_control", "conversation_id": "test_conv" } } await ws.send(json.dumps(msg)) print("Message sent.") # Keep alive and print responses while True: resp = await asyncio.wait_for(ws.recv(), timeout=5.0) print("Received:", resp) except Exception as e: print("Done:", e) asyncio.run(main())