Skip to content

Yannicked/SocketIO-Python-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is a socket.IO client written in python, it can be used to send commands and data to a socket.IO server.

socket.IO protocol: https://github.com/LearnBoost/socket.io-spec

Example to use it:
sio = socketio.socketio('127.0.0.1', 1234) #You also can use debug = True and secure = True
sio.connect() #Handshaking the server and connecting to it + starting the extra threads
sio.on('Test', callback) #if a Test event was received it will run the callback with the message as argument
sio.sendEvent({'name': 'Test', 'args' : 'Hello world'}) #sending an event

sio.heartbeat() #Dont use this, it automatically sends heartbeats to the server with a timeout given by the server
sio.disconnect() #Disconnecting from the server and stopping the server threads !!If you don't disconnect your programm will not stop running...

TODO:
Better disconnecting, probably just atexit.register(disconnect) UPDATE: this doesn't work...
...

About

A socket.io client written in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages