I set a namespace 'netty' on server, and then i create a client connect which namespace is not 'netty', so when connected, received '44/android,"Invalid namespace"' from server, but it's remain connecting to server, so i want to close that connection, but don't know where i can handle the 'Invalid namespace' error when connecting. I'm looking forward to your help. Thank you.
the sever code
`@Bean
public SocketIOServer socketIOServer() {
com.corundumstudio.socketio.Configuration config = new com.corundumstudio.socketio.Configuration();
config.setHostname(prop.getHost());
config.setPort(prop.getPort());
config.setBossThreads(prop.getBossCount());
config.setWorkerThreads(prop.getWorkCount());
config.setOrigin(null);
config.setContext("/netty");
config.setMaxHttpContentLength(prop.getMaxHttpContentLength());
config.setMaxFramePayloadLength(prop.getMaxFramePayloadLength());
SocketIOServer ioServer = new SocketIOServer(config);
return ioServer;
}`
the js code
<script type="text/javascript"> var socket = io.connect('http://192.168.199.237:8907/android', {path: '/netty', query: { type: 'web', key: '1234567', token: '987654321' }}); socket.on('message', function (data) { console.log(data); }); </script>
I set a namespace 'netty' on server, and then i create a client connect which namespace is not 'netty', so when connected, received '44/android,"Invalid namespace"' from server, but it's remain connecting to server, so i want to close that connection, but don't know where i can handle the 'Invalid namespace' error when connecting. I'm looking forward to your help. Thank you. the sever code `@Bean public SocketIOServer socketIOServer() { com.corundumstudio.socketio.Configuration config = new com.corundumstudio.socketio.Configuration(); config.setHostname(prop.getHost()); config.setPort(prop.getPort()); config.setBossThreads(prop.getBossCount()); config.setWorkerThreads(prop.getWorkCount()); config.setOrigin(null); config.setContext("/netty"); config.setMaxHttpContentLength(prop.getMaxHttpContentLength()); config.setMaxFramePayloadLength(prop.getMaxFramePayloadLength());
the js code
<script type="text/javascript"> var socket = io.connect('http://192.168.199.237:8907/android', {path: '/netty', query: { type: 'web', key: '1234567', token: '987654321' }}); socket.on('message', function (data) { console.log(data); }); </script>