Skip to main content

Modern, reliable and async-ready client for SignalR protocol

Project description

pysignalr

Pypi

pysignalr is a modern, reliable and async-ready client for SignalR protocol. This project started as an asyncio fork of mandrewcito's signalrcore library.

Usage

Let's connect to TzKT, indexer and explorer of Tezos blockchain, and subscribe to all operations:

import asyncio
from contextlib import suppress
from typing import Any, Dict, List
from pysignalr.client import SignalRClient
from pysignalr.messages import CompletionMessage


async def on_open() -> None:
    print('Connected to the server')


async def on_close() -> None:
    print('Disconnected from the server')


async def on_message(message: List[Dict[str, Any]]) -> None:
    print(f'Received message: {message}')


async def on_error(message: CompletionMessage) -> None:
    print(f'Received error: {message.error}')


async def main():
    client = SignalRClient('https://api.tzkt.io/v1/events')

    client.on_open(on_open)
    client.on_close(on_close)
    client.on_error(on_error)
    client.on('operations', on_message)

    await asyncio.gather(
        client.run(),
        client.send('SubscribeToOperations', [{}]),
    )


with suppress(KeyboardInterrupt, asyncio.CancelledError):
    asyncio.run(main())

Roadmap to the stable release

  • More documentation, both internal and user.
  • Integration tests with containerized ASP hello-world server.
  • Ensure that authentication works correctly.

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

pysignalr-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysignalr-0.1.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pysignalr-0.1.1.tar.gz.

File metadata

  • Download URL: pysignalr-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.12 Linux/5.11.0-1022-azure

File hashes

Hashes for pysignalr-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f25de7126e79d96bca0e628ec972784ca6f07cb126a67bda3237ac77a7f16c50
MD5 bf6b0dced728f97e70d15c9f501f8f58
BLAKE2b-256 973427778cbe7622da6f027ff802d12b7d5159cad62db6c079f7ff460e7810a9

See more details on using hashes here.

File details

Details for the file pysignalr-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pysignalr-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.12 Linux/5.11.0-1022-azure

File hashes

Hashes for pysignalr-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31823ec06903a9b7399d62cfac738e22ca1004ad2b312c36cca76d5c6810dcae
MD5 86db2c64eeebd71b81b30a0b5e652d93
BLAKE2b-256 43bc000641c4354e8dde32474d58452834429f8a194dd716eb7036a4c2a57245

See more details on using hashes here.

Supported by

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