最終更新:2021-08-13 (金) 11:52:37 (949d)
Python/websockets
https://github.com/aaugustin/websockets
https://websockets.readthedocs.io/en/stable/index.html
Requirements
- websockets requires Python 3.6.1?
ベース
サーバ
websockets.serve
websocket
クライアント
import asyncio import websockets async def hello(): uri = "ws://localhost:8765" async with websockets.connect(uri) as websocket: await websocket.send("Hello world!") await websocket.recv() asyncio.get_event_loop().run_until_complete(hello())