Skip to main content

Asynchronous fork of signalrcore with MessagePack support: A Python SignalR Core client, with invocation auth and two way streaming. Compatible with azure / serverless functions. Also with automatic reconnect and manual reconnect.

Project description

SignalR core client

Pypi Pypi - downloads month

This signalr core client is forked from mandrewcito. The main difference is the replacement of the synchronous websocket-client library by the asynchronous websockets library. Additionally, all methods have been made asynchronous.

See for a general introduction.

See the following samples to get an idea of the changes:

import asyncio

from signalrcore_async.hub_connection_builder import HubConnectionBuilder
from signalrcore_async.protocol.msgpack import MessagePackHubProtocol

async def main():

    protocol = "ws"
    host = "localhost"
    port = "8080"
    hub = "hub"
    hub_url = f"{protocol}://{host}:{port}/{hub}"

    connection = HubConnectionBuilder()\
                # optional: use MessagePack instead of json protocol

        # start connection
        await connection.start()

        # send (fire and forget)
        connection.send("SendName", "R2D2")

        # invoke (wait for return value)
        sum_value = await connection.invoke("Sum", [1, 2])

        # register callback
        connection.on("OnProgressChanged", _on_progress_changed)

        # stream
        await"StreamData", [1, 2], _on_next)

        # close connection
        await connection.stop()

def _on_next(data):
    pass # do something with the streamed data

def _on_progress_changed(self, args):
    progress = args[0]
    print(f"Progress: {progress * 100:.0f}%")

# run main task

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

signalrcore-async-0.5.4.tar.gz (12.3 kB view hashes)

Uploaded source

Built Distribution

signalrcore_async-0.5.4-py3-none-any.whl (16.1 kB view hashes)

Uploaded py3

Supported by

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