I am playing around with node.js and socket.io-client. I am trying to connect to a channel that does not exist in order to trigger the event \'connect_failed\' (as specified
This applies to version 1.4.5 (might work on previous versions also).
What you want to do is listen for the "error" event on the socket.io client. It will trigger this event, and the error message will be "Invalid namespace".
Here's an example of how to handle it from the socket.io client:
var ioclient = require('socket.io-client');
var websocket = ioclient('http://myserverurl.com/namespacethatdoesntexist');
websocket.on('error', function(err){
if (err == 'Invalid namespace') {
console.warn("Attempted to connect to invalid namespace");
//handle the case here...
} else {
console.warn("Error on socket.io client", err);
}
});