Skip to main content

SignalR-Async

Test Package version Supported Python versions

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.py with:
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.

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)

Source distribution for signalr-async 3.0.0
File Size Uploaded
signalr-async-3.0.0.tar.gz 15.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for signalr-async 3.0.0
File Interpreter ABI Platform
signalr_async-3.0.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page