petric3 / asyncwebsockets

Asynchronous client websockets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

asyncwebsockets

asyncwebsockets is an anyio-compatible websocket client library. Thus it works with curio, trio, or asyncio.

Installation

To install the latest stable version:

$ pip install asyncwebsockets

To install the latest development version:

$ pip install git+https://github.com/Fuyukai/asyncwebsockets.git#egg=asyncwebsockets

Basic Usage

import anyio
import asyncwebsockets

async def test():
    async with asyncwebsockets.open_websocket("wss://echo.websocket.org") as ws:
        await ws.send("test")
        evt = await ws.next_event()
        print(type(evt), getattr(evt, 'data', None))


anyio.run(test)

About

Asynchronous client websockets

License:MIT License


Languages

Language:Python 93.0%Language:Makefile 7.0%