SignalR-Async
SignalR-Async is a python client for ASP.NET & ASP.NET Core SignalR, ready for building bidirectional communication.
Installation
pip install signalr-async
Example
Create it
- Create a file
main.pywith:
import asyncio
from signalr_async.netcore import Hub, Client
from signalr_async.netcore.protocols import MessagePackProtocol
class MyHub(Hub):
async def on_connect(self, connection_id: str) -> None:
"""Will be awaited after connection established"""
async def on_disconnect(self) -> None:
"""Will be awaited after client disconnection"""
def on_event_one(self, x: bool, y: str) -> None:
"""Invoked by server synchronously on (event_one)"""
async def on_event_two(self, x: bool, y: str) -> None:
"""Invoked by server asynchronously on (event_two)"""
async def get_something(self) -> bool:
"""Invoke (method) on server"""
return await self.invoke("method", "arg1", 2)
hub = MyHub("my-hub")
@hub.on("event_three")
async def three(z: int) -> None:
pass
@hub.on
async def event_four(z: int) -> None:
pass
async def multi_event(z: int) -> None:
pass
for i in range(10):
hub.on(f"event_{i}", multi_event)
async def main():
token = "mytoken"
headers = {"Authorization": f"Bearer {token}"}
async with Client(
"https://localhost:9000",
hub,
connection_options={
"http_client_options": {"headers": headers},
"ws_client_options": {"headers": headers, "timeout": 1.0},
"protocol": MessagePackProtocol(),
},
) as client:
return await hub.get_something()
asyncio.run(main())
Resources
See the SignalR Documentation at docs.microsoft.com for documentation on the latest release.
Metadata
Release files for signalr-async 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| signalr-async-3.0.0.tar.gz | 15.3 kB | Without provenance | Details for signalr-async-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| signalr_async-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for signalr_async-3.0.0-py3-none-any.whl |
Total release size: 37.1 kB
Release files / signalr-async-3.0.0.tar.gz
| Download URL | signalr-async-3.0.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1e746ef91968e48d0fb119e0fb5fac7af3d9833d4e593dfa8ca4dec3ac8a8d7
|
|
BLAKE2b-256 checksum How to use checksums |
2696b89c5725e5902a399af078b35a28e86b55d851ebb266d41f21e1ca654727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.12 Linux/5.15.21-1-MANJARO
|
Release files / signalr_async-3.0.0-py3-none-any.whl
| Download URL | signalr_async-3.0.0-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b687dd7243281257e3af0270365a5921db8570adcf759bc1a872c4e2d3e88d64
|
|
BLAKE2b-256 checksum How to use checksums |
f52b7fba37b5c77c75913381cc937f79cf035d5cf9c4e1fb186f0192ab61ba74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.8.12 Linux/5.15.21-1-MANJARO
|
Security for signalr-async 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.