Replies: 1 comment 1 reply
-
After a look at the code I think this is how transport multiplex works: Internally |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to wrap my head around namespaces but I'm really confused at the moment.
If I get the documentation correctly, namespaces should automatically use multiplexing on the client and re-use available socket connections (provided the origin is the same) when re-establishing new connections.
This sounds awesome and is exactly what I want to implement, but I'm unable to do so. I was afraid the setup of my sockets in the app I'm working on was too complex so I reduced the code to its bare minimum for a reproduction and it seems I'm having the same issue.
The repro repo can be found here: https://github.com/Shahor/socketio-namespace-example
This is a monorepo using nestjs for the backend and nextjs for the frontend, powered by nx as a monorepo but hopefully that doesn't impact our use case.
As you can see if you start the repo and navigate using the links, you can see in the network tab that each page re-triggers a new websocket connection instead of re-using the one already available from the wrapping
_app
component.What am I not understanding? This seems to be the exact use case for multiplexing and if I'm not mistaken NextJS behaves as an SPA here so I'm not sure what is happening.
Beta Was this translation helpful? Give feedback.
All reactions