Async WebSocket client
A module that implements an asynchronous interface based on websockets for working with websockets
![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/async-websocket-client)
![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/async-websocket-client)
Functionality
- Регистрация / Удаление WS
- Создание / Удаление групп WS
- Подключение WS в группу
- Поддержка реестров: memory, redis
Quick start
Установка:
pip install async-websocket-client
update version thinks author
- aioretry , lost connect auto retry
Подключение:
import asyncio
from async_websocket_client.apps import AsyncWebSocketApp
from async_websocket_client.dispatchers import BaseDispatcher
class SomeDispatcher(BaseDispatcher):
async def on_connect(self):
return await self.ws.send('hello, server')
async def on_message(self, message: str):
return await self.ws.send(f'server, I received your message. len(message)=={len(message)}')
client = AsyncWebSocketApp('ws://localhost:8001/ws', SomeDispatcher())
client.asyncio_run()
asyncio.run(client.run())