Jest klient dostępny na indeksie pakietu python nazwie "signalr-client" SignalR który obsługuje niektóre podstawowe funkcje SignalR Source
Jest kompatybilny z Pythona V2 i V3.
Funkcjonalność obsługiwana obejmuje:
- Łączenie SignalR Hub metoda
- Wywoływanie SignalR
obsługi
- zdarzeń do przetworzenia SignalR Powiadomienia
wymaga ona następujące moduły zainstalowane poprzez pip:
- gevent
- sseclient
- websocket-client
wykorzystanie próbki, jak na linku:
#create a connection
connection = Connection(url, session)
#start a connection
connection.start()
#add a handler to process notifications to the connection
connection.handlers += lambda data: print 'Connection: new notification.', data
#get chat hub
chat_hub = connection.hub('chat')
#create new chat message handler
def message_received(message):
print 'Hub: New message.', message
#receive new chat messages from the hub
chat_hub.client.on('message_received', message_received)
#send a new message to the hub
chat_hub.server.invoke('send_message', 'Hello!')
#do not receive new messages
chat_hub.client.off('message_received', message_received)
#close the connection
connection.close()
Co jest powodem down-głosowania? Jak mogę poprawić moje pytanie, które opisuje rzeczywisty problem programowania pracy? – Den