Socket.io websocket error ENOENT
<p>I am using socket.io on my nodejs server, and it is working fine in dev environment. However, when I deployed it on production server, it started giving the following error:</p>

<pre><code>Connection Error { [Error: websocket error]
 description: 
  { [Error: connect ENOENT]
    code: 'ENOENT',
    errno: 'ENOENT',
    syscall: 'connect',
    target: 
    { domain: null,
     _events: [Object],
     _maxListeners: 10,
     _socket: null,
     _ultron: null,
     _closeReceived: false,
     bytesReceived: 0,
     readyState: 0,
     supports: [Object],
     extensions: {},
     _isServer: false,
     url: 'ws://localhost:8888/socket.io/?EIO=3&amp;transport=websocket',
     protocolVersion: 13,
     binaryType: 'buffer' } } }
</code></pre>

<p>My server side code is the following:</p>

<pre><code>var server = app.listen(8888);
var io = require('socket.io').listen(server);

var test_data_nsp = io.of('/test_data');
test_data_nsp.on('connection',function(socket){
  console.log('Connected: %s', socket.id);
  socket.on('user_connected',function(username){
        console.log("user connected");
        socket.on('disconnect',function(){
            console.log('User Disconnected');
        });
});
</code></pre>

<p>And client Side code in Mocha is the following:</p>

<pre><code>var io = require('socket.io-client');
var socketTestURL = 'http://localhost:8888/test_data';
var options ={
  transports: ['websocket'],
  'force new connection': true
};


describe("Web Socket",function(){
  it('Should open a socket connection to send testdata to the user',function(done){
        var client_test_data = io.connect(socketTestURL, options);
        client_test_data.on('connect', function(data){
        client_test_data.emit('user_connected',"test_user_name");
        done();
    });
})
});
</code></pre>

<p>I cannot understand what went wrong. Any help will be highly appreciated.</p>

<p>TIA :) </p>