File size: 669 Bytes
9b1afb5
ec48066
bc3aeb9
ec48066
9b1afb5
ec48066
f4edd80
ec48066
 
 
 
69f903a
ec48066
 
69f903a
ec48066
 
601de0d
ec48066
 
 
f4edd80
ec48066
 
e1577a5
9b1afb5
3ad6834
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import websockets
import asyncio

async def hello():
    uri = "ws://localhost:8765"

    # Connect to the WebSocket
    async with websockets.connect(uri) as websocket:
        messages = [
            '{"fn_index":2,"session_hash":"kb46puzhzr"}',
        ]

        for message in messages:
            print(f"Sending: {message}")

            # Send the message
            await websocket.send(message)

            # Receive the response
            response = await websocket.recv()
            print(f"Received: {response}")

async def main():
    await hello()

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())