-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Gateway ignores non-first connection when using dynamic namespace #5993
Comments
@jusfeel this issue should be reported in the socket.io repository. Nest simply passes down all the options you specify in the |
@jusfeel did you end up finding a solution to your issue? |
Gave it up. Finally just
|
So from what I see above, you create a base namespace |
The way I see namespace is that each connection have that namespace created on it. That's why I use the initial root namespace as some sort of "whatever" as long as it allows me to give the connection that namespace so all the connection having that namespace can be reached. Also it seems that socket.io 2 got the 'root' namespace created no matter what disregarding if you intend to a specific namespace of your own. I am waiting for nest has new version socket.io 4 release and rethink about my design. You might also want to think about using rooms instead of namespaces. For me, it's bit late. |
@jusfeel @ChrisKatsaras But, In case: Running a single socket.io node. Is there any solution for this issue ? My application has many namespaces so I needs using dynamic namespace instead of hard code. |
Given my teams requirements, we ended up going with a static set of namespaces instead of the dynamic approach. Sorry, @FA-QuangLT , no solution for you on my end 😢 |
Bug Report
Current behavior
Using dynamic namespace, say user ID for example, after restart nest server, the first client's works as excepted, whoever that may be, but next user, he cannot trigger the handle connection handler on the gateway any more. Even close all the socket, and reconnect, same. The first user ID, if it was the first connect, that namespace is the only namespace nest is able to handle Connect for that specific namespace. Seems the connection is static for the first connected client.
So behavior is that the first connection can receive and send event no problem but the next client cannot send event to the server to the namespace it is tended (server won't get it) but his namespace and socket somehow is able to receive event from the server sent to this namespace - feels like somehow namespace is able to receive event since it is namespace of a socket which the server can talk to but to send event, the client send to the namespace of that socket, that socket is completely deaf to that, mainly because the connection is never established for that socket on that namespace at all.
Input Code
Expected behavior
Current gateway for nest, if used for dynamic namespace,
should treat namespace dynamically when client has a namespace defined as it needs to
namespace itself for each client should handle connect and disconnect
You can test this from this code using socket.io library
client - copy this, change namespace 'def' to anything else, open another browser, keep refresh both browser
Possible Solution
Environment
The text was updated successfully, but these errors were encountered: