Python client proxy for SignalR.
Note: This is currently not compatible with ASP.NET Core SignalR (.NET Core 2.1), due to some changes in SignalR protocol there.
Requirements
Install requirements by running:
pip install -r requirements
Fork of SignalR client for Python based on threads instead of gevent.
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-threads 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| signalr-client-threads-0.0.12.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| signalr_client_threads-0.0.12-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 15.8 kB
Release files / signalr-client-threads-0.0.12.tar.gz
| Download URL | signalr-client-threads-0.0.12.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e2a31739b278fe02c9862f0e82ca07a5f388004643e9a3ba4326c522f806a99
|
|
BLAKE2b-256 checksum How to use checksums |
02c4d5ef8c9b2f2131e926f1f6ea2bb9fc5833a48d7dbd3a655a11954e8c068e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/2.7.15
|
Release files / signalr_client_threads-0.0.12-py2.py3-none-any.whl
| Download URL | signalr_client_threads-0.0.12-py2.py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6d4c23c891b37625c8c47305153f6c8a1b819b5ff76d9623f85867490f4d8da9
|
|
BLAKE2b-256 checksum How to use checksums |
d92c10e7981747b1712cccda5ec566adbff42f13d18ba36f27ffc2f9e4e7ba03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.6 CPython/2.7.15
|