Files
Python-2020/client_websocket.py
T
2021-01-13 00:42:36 +01:00

13 lines
288 B
Python
Executable File

#!/usr/bin/env python
import asyncio
import websockets
async def hello(uri):
async with websockets.connect(uri) as websocket:
await websocket.send("Hello world!")
await websocket.recv()
asyncio.get_event_loop().run_until_complete(
hello('ws://localhost:8765'))