List of namespaces in socket.io

Is there a way to get a list of all namespaces registered on a socket?

For example, suppose some client connects to the namespace: `socket = io ('/ some-nsp');

They are now in the namespace automatically because socket.io does not prevent the creation of random namespaces.

If I want to view a list of all existing namespaces and disable those users, how can I get such a list.

I've tried io.nsps

but it's just a circular garbage list.

Is there an "official" way to get a list of all namespaces registered on a socket? I don't need a client list. I just need a list of namespaces.

+2


source to share


1 answer


You can try this:



Object.keys(io.nsps);

      

+5


source







All Articles