Skip to main content

Python client proxy for SignalR.

Requirements

Install requirements by running:

pip install -r requirements

Signalr client is based on gevent which in turn requires Python headers. In Debian based distributions (such as Ubuntu and Raspbian) they are called python-dev.

Compatibility

Compatible with Python 2 and 3.

Usage

Here is sample usage:

from requests import Session
from signalr import Connection

with Session() as session:
    #create a connection
    connection = Connection("http://localhost:5000/signalr", session)

    #get chat hub
    chat = connection.register_hub('chat')

    #start a connection
    connection.start()

    #create new chat message handler
    def print_received_message(data):
        print('received: ', data)

    #create new chat topic handler
    def print_topic(topic, user):
        print('topic: ', topic, user)

    #create error handler
    def print_error(error):
        print('error: ', error)

    #receive new chat messages from the hub
    chat.client.on('newMessageReceived', print_received_message)

    #change chat topic
    chat.client.on('topicChanged', print_topic)

    #process errors
    connection.error += print_error

    #start connection, optionally can be connection.start()
    with connection:

        #post new message
        chat.server.invoke('send', 'Python is here')

        #change chat topic
        chat.server.invoke('setTopic', 'Welcome python!')

        #invoke server method that throws error
        chat.server.invoke('requestError')

        #post another message
        chat.server.invoke('send', 'Bye-bye!')

        #wait a second before exit
        connection.wait(1)

Metadata

Release files for signalr-client 0.0.7

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-client 0.0.7
File Size Uploaded
signalr-client-0.0.7.zip 9.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for signalr-client 0.0.7
File Interpreter ABI Platform
signalr_client-0.0.7-py3-none-any.whl Python 3 none any Details
signalr_client-0.0.7-py2-none-any.whl Python 2 none any Details

Total release size: 28.2 kB

Release files / signalr-client-0.0.7.zip

Download URL signalr-client-0.0.7.zip
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
16ff89484394fe8b84ec82a97c7b954c76815bc66949d794e584ac8d8382a49b
BLAKE2b-256 checksum
How to use checksums
2ef9f473918805096752937d2d8a90f0e84a876a8c4eb8ede8845f26d629eebf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / signalr_client-0.0.7-py3-none-any.whl

Download URL signalr_client-0.0.7-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91e4ac4dedd4bd8887610f6a7171e37364daaf66131feb0a4cd9bf2f13fe19cc
BLAKE2b-256 checksum
How to use checksums
39fa2085d8f6062821b8c48a79a20f32410798af7ee5bd2f64d70c1468656348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / signalr_client-0.0.7-py2-none-any.whl

Download URL signalr_client-0.0.7-py2-none-any.whl
Size 9.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
a0cf5efc4e33dcbdf866ad7adea7acf1e73cbbc8ee7e6895b95c8a1051b31661
BLAKE2b-256 checksum
How to use checksums
ba9bab0d019cbe8149be2e0f3f80aba80eaaf1c3b8506c80cc29e79d309fa91b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.7 This release

3 release files

0.0.6

3 release files

0.0.5

2 release files

0.0.4

1 release file

0.0.3

1 release file

0.0.2

2 release files

0.0.1

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