Skip to content
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

Namespace setup for no namespace #2

Open
cadavre opened this issue Oct 6, 2015 · 2 comments
Open

Namespace setup for no namespace #2

cadavre opened this issue Oct 6, 2015 · 2 comments

Comments

@cadavre
Copy link

cadavre commented Oct 6, 2015

Is there a way to setup default namespace '/'?
If I fire:
io.setupNamespace('/', function (nsp) { }
It is called for default namespace but if I use middleware inside it's called for all custom namespaces too.

What I want to achieve is – disallow connections to no namespace. My idea was – decline connection with error in middleware. Any idea?

@davidbau
Copy link
Member

davidbau commented Oct 6, 2015

Good question. I haven't looked at the code for a while, but my
recollection is that the default namespace is used for bootstrapping
connections to other specific namespaces, so there may be subtleties in
disabling it. If you do look into it and come up with a patch, I'd be
happy to review.

On Tue, Oct 6, 2015 at 10:45 AM, Seweryn Zeman [email protected]
wrote:

Is there a way to setup default namespace '/'?
If I fire:

io.setupNamespace('/', function (nsp) {
}

It is called for default namespace but if I use middleware inside it's
called for all custom namespaces too.

What I want to achieve is – disallow connections to no namespace. My idea
was – decline connection with error in middleware. Any idea?


Reply to this email directly or view it on GitHub
#2.

@cadavre
Copy link
Author

cadavre commented Oct 6, 2015

Yes, I already noticed it is used always as bootstrapped connection in the beginning. And also I guess it cannot change because while Socket.IO starts – it needs at least one point to be setup. For now I designed my emitter so it will use only channels and nsps when emitting, so as long as I'm not gonna use socket.broadcast.emit() it's gonna be fine I guess. But I'll need further investigation on security. I'll also take a look further and send you merge requests when something nice found. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants