Skip to content

Commit 9660a72

Browse files
author
Yannicked
committed
Update README
1 parent a47cfee commit 9660a72

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

README

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
Usage:
2-
import socketio
1+
This is a socket.IO client written in python, it can be used to send commands and data to a socket.IO server.
32

4-
sio = socketio.socketio(server ip, server port) # define the server
3+
socket.IO protocol: https://github.com/LearnBoost/socket.io-spec
54

6-
sio.connect() # connect
7-
sio.receiveMsg(timeout) # receive (timeout is not tested)
8-
sio.sendMsg(string) # send
9-
sio.disconnect() # disconnect
5+
Example to use it:
6+
sio = socketio.socketio('127.0.0.1' 1234) #You also can use debug = True and secure = True
7+
sio.connect() #Handshaking the server and connecting to it + starting the extra threads
8+
sio.sendEvent({'name': 'Test', 'args' : 'Hello world'}) #sending an event
9+
event = sio.receiveEvent() # returns a dictonary with a name and a args key
10+
sio.heartbeat() #Dont use this, it automatically sends heartbeats to the server with a timeout given by the server
11+
sio.disconnect() #Disconnecting from the server and stopping the server threads !!If you don't disconnect your programm will not stop running...
1012

11-
12-
Confirmed working:
13-
connecting
14-
sending heartbeat every (gets this value from the server) seconds
15-
sending a string
16-
sending a event
17-
receiving a string
18-
disconnecting
13+
TODO:
14+
Better disconnecting, probably just atexit.register(disconnect)
15+
...

0 commit comments

Comments
 (0)