-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Since Socket.IO v3, it is not mandatory anymore for the client to connect to the main namespace.
Registering a global middleware which applies to all namespace is thus a bit messier:
const of = io.of;
io.of = (...args) => {
const nsp = of.call(io, ...args);
nsp.use(yourMiddleware);
return nsp;
}
Describe the solution you'd like
io.<name of the method>(yourMiddleware); // register a middleware which will be attached to each namespace
Describe alternatives you've considered
Registering a global middleware is possible for dynamic namespaces:
const parentNamespace = io.of(/^\/dynamic-\d+$/);
parentNamespace.use(yourMiddleware); // attached to all child namespaces
Additional context
Related: #3842
martinj, machinaeXphilip, bliteknight, Snakey42069 and aguecida
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request