Send a socket id different from the engine socket id for each namespace
Totodore opened this issue · comments
Currently the socket id that reference a socket.io socket (one for each namespace) is the same than the engine socket id.
The implementation should match the socket.io server in node which create a new socket id for each new socket connected to a namespace (only for the socket.io v5 protocol) :
It appears that solving this issue implies a big refactoring. Indeed referencing socketio socket with custom sid instead is impossible because of the following architecture :
client recv data from engine socket -> route to corresponding namespace -> route to corresponding socket with <Engine id -> socket> hashmap
Because the socket id is not in the request it is impossible to map socket by their socket id (and not their engine id).
The solution would be to refactor the code to match the official architecture :
client wraps an engine socket and holds a map of the ns -> socket
.
Or alternatively to keep the current architecture we could store a hashmap containing all the namespace for a given socket in the SocketData
struct