Skip to main content

No project description provided

Project description

Async WebSocket client

A module that implements an asynchronous interface based on websockets for working with websockets

PyPI PyPI - Python Version GitLab last commit

Test coverage Downloads GitLab stars

Functionality

  • Регистрация / Удаление WS
  • Создание / Удаление групп WS
  • Подключение WS в группу
  • Поддержка реестров: memory, redis

Quick start

Установка:

pip install async-websocket-client

Подключение:

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() # quick run
# or
asyncio.run(client.run()) # Run with asyncio

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_websocket_client-0.1.0.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

async_websocket_client-0.1.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page