Er. Mohit Agrawal
Er. Mohit Agrawal

Reputation: 2276

Socket.io using default namespace with some custom namepsace, not working

I am trying to use default namespace '\' for connecting general android application sockets with Socket.io , but I want to make custom namespace for website like '/web' but when client with io.connect('/web') it connects to default namespace.

basically i want authorization of all, but not for /web namespace.
here is my code

io.sockets.on('connection', function (socket, next) {
  //some handshaking data to varify connection
}

io.of('/web').on('connection', function(socket, next) {
  //HERE i want to SKIP verification
}


but I got request on default instead of /web.

Upvotes: 2

Views: 1034

Answers (1)

bolav
bolav

Reputation: 6998

socket.io connection event will trigger for /default namespace on all socket connections.

Later events from the client will only trigger on the namespace you are connected to.

Upvotes: 1

Related Questions