Skip to main content

Python SignalR async client

Project description


Test Package version Supported Python versions

SignalR-Async is a python client for ASP.NET & ASP.NET Core SignalR, ready for building bidirectional communication.


pip install signalr-async


Create it

  • Create a file 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")

async def three(z: int) -> None:

async def event_four(z: int) -> None:

async def multi_event(z: int) -> None:

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(
            "http_client_options": {"headers": headers},
            "ws_client_options": {"headers": headers, "timeout": 1.0},
            "protocol": MessagePackProtocol(),
    ) as client:
        return await hub.get_something()


See the SignalR Documentation at for documentation on the latest release.

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

signalr-async-3.0.0.tar.gz (15.3 kB view hashes)

Uploaded source

Built Distribution

signalr_async-3.0.0-py3-none-any.whl (21.8 kB view hashes)

Uploaded py3

Supported by

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