Fork of SignalR client for Python based on threads instead of gevent
Project description
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)
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
Built Distribution
Close
Hashes for signalr-client-threads-0.0.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90f639b53ce213012ee0bf1c6af546c50ffb2ceb4e2a0a9c93a836bbd85072c3 |
|
MD5 | a724c2bd3b93ca1f111f4ed53761ec86 |
|
BLAKE2b-256 | 22c72fbb4310ac06fa5284283745aab067224853ee715c2c24cab03f1ecc3d58 |
Close
Hashes for signalr_client_threads-0.0.10-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dac5e13f25524d151c66172a4a2a8a84f23097fc1c23560f656fcf7cf9920ce3 |
|
MD5 | 2e45e20315982c6ec8edff32767ad75e |
|
BLAKE2b-256 | 6f35e9249a4abd2c01ae77c68779f63e40cb2bfb4b1cee4807ec1d36eaf839e4 |