-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Root nsp middleware always called before sub nsp middleware authorization #1888
Comments
Currently when a client connects it always (also) joins the root namespace. This is convenient in some cases, but it shouldn't be able to block connecting to the target namespace right? |
That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible). |
This is still very much an issue in v2.1. Just like @peteruithoven, I need to have authentication on the default namespace as well as custom namespaces. When the client connects to a custom namespace with invalid credentials, they never get the error event (or any event for that matter, it just hangs). Can we reopen this? |
@murrayju thanks for bringing that to my attention! Could you please give a look at socketio/socket.io-client#1202? |
@darrachequesne There i faced a similar issue. I am using Socket Manager at client side for creating a namespace socket connection. On server side i used namespace middleware for authentication. It works fine for the first time, when close the socket(in my case single socket open at client side, closing that close the manager as well), connecting the manager and socket again, keeps the manager in 'opening' state. If I remove the namespace middleware and apply it to the default namespace, all works fine, manager and socket reconnects back with authentication. Any idea? |
For future readers: this was fixed in Socket.IO v3 Documentation: |
It's now possible to define middleware per namespace, but when this is used for authorization there is an issue. The issue is that the root namespace authorization is always called first, when this fails the namespace specific authorization isn't called. This makes it "impossible" to send the client an error from the namespace it was connecting to.
Not sure what would be the best solution here...
The text was updated successfully, but these errors were encountered: