Modern, reliable and async-ready client for SignalR protocol
Project description
pysignalr
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f25de7126e79d96bca0e628ec972784ca6f07cb126a67bda3237ac77a7f16c50
|
|
| MD5 |
bf6b0dced728f97e70d15c9f501f8f58
|
|
| BLAKE2b-256 |
973427778cbe7622da6f027ff802d12b7d5159cad62db6c079f7ff460e7810a9
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31823ec06903a9b7399d62cfac738e22ca1004ad2b312c36cca76d5c6810dcae
|
|
| MD5 |
86db2c64eeebd71b81b30a0b5e652d93
|
|
| BLAKE2b-256 |
43bc000641c4354e8dde32474d58452834429f8a194dd716eb7036a4c2a57245
|