Cannot connect from node #372

robertpitt opened this Issue Jan 19, 2012 · 18 comments


None yet
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

toots commented Jan 22, 2012

I have this issue as well.

liamks commented Jan 25, 2012

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


einaros commented Jan 25, 2012

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.

Is master stable enough for a point release? It'd be nice to get this fix out in the wild.

On 2012-01-25, at 6:17 PM, Liam wrote:

Thank you!!!

For others:

npm install

Reply to this email directly or view it on GitHub:
LearnBoost#372 (comment)


einaros commented Jan 25, 2012

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 }


rauchg commented Jan 7, 2014

Try tarball?


rauchg commented Jan 7, 2014

(instead of zipball in that URL)


rauchg commented Jan 7, 2014

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 closed this Nov 25, 2014

@lattmann lattmann pushed a commit to lattmann/ that referenced this issue Jul 23, 2015

@3rd-Eden 3rd-Eden Potential fix for #372 f784c47

@lattmann lattmann pushed a commit to lattmann/ that referenced this issue Jul 23, 2015

@rauchg rauchg Merge pull request #396 from 3rd-Eden/xxs
Potential fix for #372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment