Skip to content

mherrmann/signalr-client-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

signalr-client-py

Python client proxy for SignalR.

Requirements

Install the following prerequisites using pip:

  • sseclient
  • websocket-client

Compatibility

Compatible with Python 2 and 3.

Usage

#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()

About

python client proxy for signalr

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •