Skip to main content

Fork of SignalR client for Python based on threads instead of gevent

Project description

signalr-client-threads
=================

Python client proxy for `SignalR <http://signalr.net/>`_.


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)



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-client-threads-0.0.8.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

signalr_client_threads-0.0.8-py2.py3-none-any.whl (9.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file signalr-client-threads-0.0.8.tar.gz.

File metadata

File hashes

Hashes for signalr-client-threads-0.0.8.tar.gz
Algorithm Hash digest
SHA256 d981890abe7e80f7a5b575b56794d3b49888dfe2848f691a8b21c8fa82718ba9
MD5 5e2e6c67a4d9bb597d67f9e7ceb703a4
BLAKE2b-256 60c159216d00e8cecfee26ed3d0bc13ece73eacc03d424eccb848a23bef84c47

See more details on using hashes here.

File details

Details for the file signalr_client_threads-0.0.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for signalr_client_threads-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1598ad203245d72bea0b6f79d72cf6a1a07de8c7d7dd0215693d892d9c1322ad
MD5 3f55a6148f1f9fcd85cb20c0900a9fb1
BLAKE2b-256 b28c7352527bd63fae1fd7bd5420a2055b44807eed4ff5732da450d78b519d97

See more details on using hashes here.

Supported by

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