-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ws.py
More file actions
21 lines (19 loc) · 741 Bytes
/
test_ws.py
File metadata and controls
21 lines (19 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import asyncio
import websockets
import json
async def test():
uri = "ws://localhost:3000/solve"
try:
async with websockets.connect(uri) as websocket:
print(f"Connected to {uri}")
# Send a simple message if protocol expects one, or just wait
# The protocol expects Bincode, but maybe we can just connect.
# We won't send anything to avoid crashing if it expects specific format.
# Just connecting is enough to prove it works.
print("Connection successful")
await asyncio.sleep(1)
print("Closing connection")
except Exception as e:
print(f"Connection failed: {e}")
if __name__ == "__main__":
asyncio.run(test())