clone3 commited on
Commit
69f903a
·
1 Parent(s): f65d373

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -5,7 +5,10 @@ def hello():
5
 
6
  # Connect to the WebSocket
7
  websocket = websockets.connect(uri)
8
-
 
 
 
9
  messages = [
10
  '{"fn_index":2,"session_hash":"kb46puzhzr"}',
11
  '{"data":["spider",1683852825,8,4,true],"event_data":null,"fn_index":2,"session_hash":"kb46puzhzr"}'
@@ -22,7 +25,7 @@ def hello():
22
  print(f"Received: {response}")
23
 
24
  # Close the WebSocket connection
25
- websocket.close()
26
 
27
  if __name__ == "__main__":
28
  hello()
 
5
 
6
  # Connect to the WebSocket
7
  websocket = websockets.connect(uri)
8
+
9
+ # Establish the connection
10
+ websocket = websocket.__enter__()
11
+
12
  messages = [
13
  '{"fn_index":2,"session_hash":"kb46puzhzr"}',
14
  '{"data":["spider",1683852825,8,4,true],"event_data":null,"fn_index":2,"session_hash":"kb46puzhzr"}'
 
25
  print(f"Received: {response}")
26
 
27
  # Close the WebSocket connection
28
+ websocket.__exit__()
29
 
30
  if __name__ == "__main__":
31
  hello()