🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

websocket-client-asyncio

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websocket-client-asyncio

async_websocket_client

1.1.3
PyPI
Maintainers
1

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

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts