Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Cannot connect from node #372

robertpitt opened this Issue · 18 comments

8 participants


Seems like does not work in node@v0.6.7 running under node.


├─┬ node-inspector@0.1.10 
│ └── paperboy@0.0.3 
│ ├── policyfile@0.0.4 
│ ├── redis@0.6.7 
│ └─┬ 
│   ├── uglify-js@1.0.6 
│   ├── websocket-client@1.0.0 
│   └── xmlhttprequest@1.2.2 
  ├── uglify-js@1.0.6 
  ├── websocket-client@1.0.0 
  └── xmlhttprequest@1.2.2 

Running node@v0.6.7 it does not connect to any servers, test and production, the only events that are fired are connectiong and connect_failed.

Test Code

var SocketIOClient = require('');
var protocol    = 'ws';
var domain  = '';
var port    = 2006;
var options = {
    'max reconnection attempts' : 10,
    'reconnection delay'        : 2000,
    'transports'            : [

var IOClient = SocketIOClient.connect(protocol + '://' + domain + ':' + port, options);

IOClient.on('connect', function(){
    console.log("Connected", arguments);

IOClient.on('connecting', function(){
    console.log("Connecting", arguments);

IOClient.on('connect_failed', function(){
    console.log("Connect Failed", arguments);

IOClient.on('message', function(){
    console.log("Message", arguments);

IOClient.on('reconnecting', function(){
    console.log("Reconnecting", arguments);

IOClient.on('reconnect_failed', function(){
    console.log("Reconnecting failed", arguments);

IOClient.on('close', function(){
    console.log("Server Closed", arguments);

IOClient.on('disconnect', function () {
    console.log("Disconnected", arguments);


> node server.js
> Connecting { '0': 'websocket' }
> The "sys" module is now called "util". It should have a similar interface.
> Connect Failed {}

Theres about a 4-5 second delay between Connecting and Connection Failed

There's nothing wrong with the server sides it has thousands of clients connected via web-based websocket, seems like it might be a problem with the websocket-client

Can you please advise, thank you.


I had the same issue as well, but saw the client try to connect with the XHR transport after a while.


as you can see fro, the sample code I was using it does not allow XHR, only websocket permitted.

I have also traced it to the point where the available sockets are finalized and it stays at websocket, also it seems to close in the websocket-client module


I have this issue as well.


I also have this issue. @robertpitt how did you patch to get it to work?


If you use master, rather than the latest npm version, this should be fixed. The websocket-client module has been replaced by the much more up to date ws.


It should be. If @guille just stops slacking off at NodeSummit, a new version could be pushed.


For those that just want's to patch there current setup you can just grab the following file:

And then replace the following file:



I am also getting this problem using the OP's code and the current version of socket-io-client. Did ANYONE get this working?

Connecting { '0': 'websocket' }
Connected {}
Disconnected { '0': undefined }
Reconnecting { '0': 4000, '1': 1 }
Reconnecting { '0': 8000, '1': 2 }
Connecting { '0': 'websocket' }
Connected {}
Disconnected { '0': undefined }
Reconnecting { '0': 4000, '1': 1 }


Try tarball?


(instead of zipball in that URL)


Oh by the way master is 1.0.0 so you might be looking for the latest 0.9.x tag instead


@guille Thanks! to be honest I'm not sure which version I need I just want something that works! I'm not sure if there is something wrong with the server I am trying to connect to, but I'm having the same problem as the original poster in this thread.


Tarball works (thanks) but installing 1.0 has the effect that my script now doesn't output anything, it just quits :(

@rauchg rauchg closed this
@lattmann lattmann referenced this issue from a commit in lattmann/
@3rd-Eden 3rd-Eden Potential fix for #372 f784c47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.