Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,28 @@ async def send_wss_request():
|
|
10 |
while True:
|
11 |
try:
|
12 |
async with websockets.connect(uri) as websocket:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Receive the response
|
14 |
response = await websocket.recv()
|
15 |
print(f"Received: {response}")
|
@@ -19,6 +41,27 @@ async def send_wss_request():
|
|
19 |
response = await websocket.recv()
|
20 |
print(f"Received: {response}")
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
except websockets.exceptions.ConnectionClosed:
|
23 |
print("Connection closed. Reconnecting in 30 minutes.")
|
24 |
|
|
|
10 |
while True:
|
11 |
try:
|
12 |
async with websockets.connect(uri) as websocket:
|
13 |
+
async with websockets.connect(uri) as websocket:
|
14 |
+
# Receive the response
|
15 |
+
response = await websocket.recv()
|
16 |
+
print(f"Received: {response}")
|
17 |
+
|
18 |
+
# Send a message
|
19 |
+
message = '{"fn_index":2,"session_hash":"kb46puzhzr"}'
|
20 |
+
await websocket.send(message)
|
21 |
+
print(f"Sent: {message}")
|
22 |
+
|
23 |
+
# Receive the response
|
24 |
+
response = await websocket.recv()
|
25 |
+
print(f"Received: {response}")
|
26 |
+
|
27 |
+
# Receive the response
|
28 |
+
response = await websocket.recv()
|
29 |
+
print(f"Received: {response}")
|
30 |
+
|
31 |
+
message='{"data":["spiderman",1683852825,8,4,true],"event_data":null,"fn_index":2,"session_hash":"kb46puzhzr"}'
|
32 |
+
await websocket.send(message)
|
33 |
+
print(f"Sent: {message}")
|
34 |
+
|
35 |
# Receive the response
|
36 |
response = await websocket.recv()
|
37 |
print(f"Received: {response}")
|
|
|
41 |
response = await websocket.recv()
|
42 |
print(f"Received: {response}")
|
43 |
|
44 |
+
# Send a message
|
45 |
+
message = '{"fn_index":2,"session_hash":"kb46puzhzr"}'
|
46 |
+
await websocket.send(message)
|
47 |
+
print(f"Sent: {message}")
|
48 |
+
|
49 |
+
# Receive the response
|
50 |
+
response = await websocket.recv()
|
51 |
+
print(f"Received: {response}")
|
52 |
+
|
53 |
+
# Receive the response
|
54 |
+
response = await websocket.recv()
|
55 |
+
print(f"Received: {response}")
|
56 |
+
|
57 |
+
message='{"data":["spiderman",1683852825,8,4,true],"event_data":null,"fn_index":2,"session_hash":"kb46puzhzr"}'
|
58 |
+
await websocket.send(message)
|
59 |
+
print(f"Sent: {message}")
|
60 |
+
|
61 |
+
# Receive the response
|
62 |
+
response = await websocket.recv()
|
63 |
+
print(f"Received: {response}")
|
64 |
+
|
65 |
except websockets.exceptions.ConnectionClosed:
|
66 |
print("Connection closed. Reconnecting in 30 minutes.")
|
67 |
|