invisibleroads / invisibleroads/socketIO-client
Initialize the socketIO too slow
- Dominant language
- Python
- Stars
- 441
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
I have a simple client as shown below.
It spends 1 min to run the following line, which is too slow.
`socketIO = SocketIO('localhost',3003)`
I wonder how to solve this problem?
I use eventlet and didn't install socketIO-client in virtual environment.
Would it cause this problem?
```
from socketIO_client import SocketIO, BaseNamespace
from datetime import datetime
Devices = {}
temp_time = datetime.now()
class Namespace(BaseNamespace):
def on_connect(self):
print('[Connected]')
for device in Devices:
self.emit('register', device)
time.sleep(1)
def funcA():
do something
def funcB():
do something
print '1:', datetime.now()-temp_time
socketIO = SocketIO('localhost', 3003)
print '2:', datetime.now()-temp_time
socketIO.define(Namespace)
socketIO.on('eventA', funcA)
socketIO.on('eventB', funcB)
socketIO.wait()
```
The output of the client part:
```
1: 0:00:00.000074
DEBUG:root:localhost:3003/socket.io [transport selected] xhr-polling
DEBUG:root:localhost:3003/socket.io [heartbeat reset]
2: 0:01:00.019828
DEBUG:root:localhost:3003/socket.io [socket.io packet received] 0
[Connected]
```
##
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.