Development documents and examples for websockets
``websockets`` is a library for building WebSocket servers_ and clients_ in Python with a focus on correctness and simplicity. Built on top of ``asyncio``, Python's standard asynchronous I/O framework, it provides an elegant coroutine-based API. `Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>`_ Here's how a client sends and receives messages: 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')) And here's an echo server: import asyncio import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) asyncio.get_event_loop().run_until_complete( websockets.serve(echo, 'localhost', 8765)) asyncio.get_event_loop().run_forever() Does that look good? `Get started with the tutorial! <https://websockets.readthedocs.io/en/stable/intro.html>`_
acquired package info from repodata DB: repodata/f1f85c23079e7764ad00378a9fc5d660b89a03657290e75426caf7be5b7da462-primary.sqlite.bz2