I wrote a simple client with namespace connecting to my server and emit events to the namespaces. but some exceptions(maybe different each time) raised.
I put sio.wait in another thread because the main thread has other works to do. I have not use any critical resource and just print the received messages in my handler.
sio = SocketIO('localhost')
nsp = sio.define(handler, '/namespace')
t = threading.Thread(target=sio.wait)
t.start()
nsp.emit('xxx', {}) # exception raised here
# if start a thread after emit, the exception will not raise
# t = threading.Thread(target=sio.wait)
# t.start()
while True:
time.sleep(1) # endless loop
Could you please help me which I wrote in incorrect way.
I wrote a simple client with namespace connecting to my server and emit events to the namespaces. but some exceptions(maybe different each time) raised.
I put
sio.wait
in another thread because the main thread has other works to do. I have not use any critical resource and just print the received messages in my handler.Could you please help me which I wrote in incorrect way.