Skip to content
Snippets Groups Projects
api_call.py 314 B
# websocket_client.py
import asyncio

import websockets


async def send_message():
    uri = "ws://127.0.0.1:8000/ws"
    async with websockets.connect(uri) as websocket:
        await websocket.send("Hello, server!")
        response = await websocket.recv()
        print(response)

asyncio.run(send_message())