clone3 commited on
Commit
02e7b61
·
1 Parent(s): bb675e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -2
app.py CHANGED
@@ -3,6 +3,7 @@ import websockets
3
 
4
  async def send_wss_request():
5
  uri = "wss://clone3-imagex-clone-advance.hf.space/queue/join"
 
6
 
7
  while True:
8
  try:
@@ -32,8 +33,32 @@ async def send_wss_request():
32
  response = await websocket.recv()
33
  print(f"Received: {response}")
34
 
35
- except websockets.exceptions.ConnectionClosed:
36
- print("Connection closed. Reconnecting in 30 minutes.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  # Sleep for 30 minutes before the next iteration
39
  await asyncio.sleep(30 * 60)
 
3
 
4
  async def send_wss_request():
5
  uri = "wss://clone3-imagex-clone-advance.hf.space/queue/join"
6
+ uri2 = "wss://clone3-imagex-clone-advance.hf.space/queue/join"
7
 
8
  while True:
9
  try:
 
33
  response = await websocket.recv()
34
  print(f"Received: {response}")
35
 
36
+
37
+ async with websockets.connect(uri2) as websocket:
38
+ # Receive the response
39
+ response = await websocket.recv()
40
+ print(f"Received: {response}")
41
+
42
+ # Send a message
43
+ message = '{"fn_index":2,"session_hash":"kb46puzhzr"}'
44
+ await websocket.send(message)
45
+ print(f"Sent: {message}")
46
+
47
+ # Receive the response
48
+ response = await websocket.recv()
49
+ print(f"Received: {response}")
50
+
51
+ # Receive the response
52
+ response = await websocket.recv()
53
+ print(f"Received: {response}")
54
+
55
+ message='{"data":["spiderman",1683852825,8,4,true],"event_data":null,"fn_index":2,"session_hash":"kb46puzhzr"}'
56
+ await websocket.send(message)
57
+ print(f"Sent: {message}")
58
+
59
+ # Receive the response
60
+ response = await websocket.recv()
61
+ print(f"Received: {response}")
62
 
63
  # Sleep for 30 minutes before the next iteration
64
  await asyncio.sleep(30 * 60)