File size: 316 Bytes
e272f4f
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import asyncio
import websockets
import json

async def test_ws():
    uri = "ws://localhost:8000/ws/test-session"
    async with websockets.connect(uri) as ws:
        await ws.send(json.dumps({"query": "What is AI?"}))
        response = await ws.recv()
        print("Response:", response)

asyncio.run(test_ws())