socketIO-client
socketIO-client copied to clipboard
Namespace Standard Events not firing
According to the documentation it would seem that the following
class Namespace(BaseNamespace):
def on_connect(self):
print('[Connected]')
...
socketIO = SocketIO('localhost', 8000, Namespace)
socketIO.wait(seconds=1)
ought to fire the on_connect
callback for the root namespace, however I'm not seeing this behavior. I see the following outputted:
dwalker@host:/src › python client.py
DEBUG:socketIO-client:127.0.0.1:8000/socket.io [engine.io transport selected] websocket
DEBUG:socketIO-client:127.0.0.1:8000/socket.io [engine.io heartbeat reset]
However, if I change the code to use the .define() we do see the on_connect called for a given new namespace
socketIO = SocketIO('http://127.0.0.1', 8000)
socketIO.define(Namespace, '/ns')
we get the following
dwalker@host:/src › python client.py
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [engine.io transport selected] websocket
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [engine.io heartbeat reset]
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [socket.io packet sent] 0/ns,
DEBUG:socketIO-client:127.0.0.1:5000/socket.io /ns [socket.io waiting for connection]
DEBUG:socketIO-client:127.0.0.1:5000/socket.io /ns [socket.io waiting for connection]
DEBUG:socketIO-client:127.0.0.1:5000/socket.io [socket.io packet received] b'0/ns'
[Connected]
Am I missing something with the documentation, or should the root Namesapce also be getting to the on_connect callback?
Same problem here. Events doesn't fire and if the computer goes out of internet it stucks in the emit. I'm trying to find a workaround for this :/
There is a solution for this problem: socketIO = SocketIO( _SERVER_ADRESS, _SERVER_PORT, BaseNamespace, wait_for_connection=False) At least here, It's working normally now.
I have the same problem, whenever I emit from my server, the client's event doesn't catch the message. @PY1CX thanks for a solution , however it doesn't work in my case :|
Same problem here. The client can emit but never get message from other clients.
Same here. If you define a namespace with work OK.
Having the same issue. No matter what implementation I try it doesn't trigger. It does connect and can send messages though.
Seems to be related to the socket.io 2 fork, only packets of type 3 and 4 seem to be received I'll take it there.
So, is there any viable solution/workaround for this issue?
I have the same problem