#!/usr/bin/env python import asyncio import json import random import uuid from websockets.client import connect async def hello(): async with connect("wss://api.codey.lol/cah/") as websocket: message = await websocket.recv() x = str(uuid.uuid4()) print(f"Init Message: {message}") await websocket.send(json.dumps({ "event": "handshake", "data": { "resource": f"Test Client UUID {x}", "platform": "Discord", "csid": "2bd60a53-023d-49a5-a668-ce8fa8f6ec7f", } })) while True: message = await websocket.recv() print(message) await asyncio.sleep(random.uniform(20, 35)) await websocket.close() # for x in range(0, 200): # await websocket.send(f"Hello world! {x}") # message = await websocket.recv() # print(f"Received: {message}") # await asyncio.sleep(0.2) asyncio.get_event_loop().create_task(hello()) asyncio.get_event_loop().run_forever()