-
-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client is getting socketio.exceptions.BadNamespaceError after reconnecting #920
Comments
I think the problem here is in your interpretation of what is the purpose of the Your connect handler is emitting an event to the client. Then you have your client emit back. The emit from client to server fails, because the namespace connection is not going to be established fully until after the connect handler returns. An alternative that you can try is to add the |
Thank you! Adding |
…' option when the server creates SocketIO objects as discussed on miguelgrinberg/python-socketio#920. This fixes issue #1333
…' option when the server creates SocketIO objects as discussed on miguelgrinberg/python-socketio#920. This fixes issue #1333 (comming including blackformatting)
Describe the bug
I have a client using python-socketio connected to a flask socketio server. When test stopping the server process and re-running it, the client throws 'BadNamespaceError'. I believe it may have something to do with the fact that the server listens to 'connect' events and then immediately broadcasts a 'get_state' event, so the client gets a 'get_state' right after re-connecting? Is this a bug and if not can I do anything to avoid it?
Here's my cut down code which still produces the error:
Client code:
Flask socketio server:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
This exception shouldn't be raised
Logs
Additional context
I've seen #634 but that was for an older version I think. I'm using 5.6.0 from pip. Also, this issue doesn't happen after connecting the first time, only after a disconnect and reconnect.
The text was updated successfully, but these errors were encountered: