Skip to content

websocket proxy not work in node.js version 0.10.0 #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
llevkin opened this issue Mar 19, 2013 · 9 comments
Closed

websocket proxy not work in node.js version 0.10.0 #387

llevkin opened this issue Mar 19, 2013 · 9 comments

Comments

@llevkin
Copy link

llevkin commented Mar 19, 2013

a simple test:

var util = require('util'),
http = require('http'),
httpProxy = require('http-proxy');

try {
var io = require('socket.io'),
client = require('socket.io-client');
}
catch (ex) {
console.error('Socket.io is required for this example:');
process.exit(1);
}

//
// Create the target HTTP server and setup
// socket.io on it.
//
var server = io.listen(8080);
server.set('transports', ['websocket']);
server.sockets.on('connection', function (client) {
util.debug('Got websocket connection');

client.on('message', function (msg) {
util.debug('Got message from client: ' + msg);
});
client.send('from server');
});

//
// Create a proxy server with node-http-proxy
//
httpProxy.createServer(8080, 'localhost').listen(8081);

//
// Setup the socket.io client against our proxy
//
var ws = client.connect('ws://localhost:8081');

ws.on('message', function (msg) {
util.debug('Got message: ' + msg);
});

in node.js version 0.10.0 we are never got a message 'Got message: from server'.. In ver. 0.8.18 all work fine..

@truongsinh
Copy link

+1, I traceback from LearnBoost's up (depends on LB's distrubute, which in turn depends on NJS's node-http-proxy).
NPM test results in timeout while trying

 ♢ node-http-proxy/routing-proxy/ws-to-ws 

   info  - socket.io started
   debug - client authorized
   info  - handshake authorized izC7UT_NUURZlObaw-EL
   debug - setting request GET /socket.io/1/websocket/Welcome%20to%20socket.io.
   debug - set heartbeat interval for client Welcome%20to%20socket.io.
   debug - websocket writing 7:::1+0
   warn  - client not handshaken client should reconnect
   info  - transport end (error)
   debug - set close timeout for client Welcome%20to%20socket.io.
   debug - cleared close timeout for client Welcome%20to%20socket.io.
   debug - cleared heartbeat interval for client Welcome%20to%20socket.io.
   debug - discarding transport
   debug - setting request GET /socket.io/1/websocket/Welcome%20to%20socket.io.
   debug - set heartbeat interval for client Welcome%20to%20socket.io.
   debug - websocket writing 7:::1+0
   warn  - client not handshaken client should reconnect
   info  - transport end (error)
   debug - set close timeout for client Welcome%20to%20socket.io.
   debug - cleared close timeout for client Welcome%20to%20socket.io.
   debug - cleared heartbeat interval for client Welcome%20to%20socket.io.
   debug - discarding transport

@truongsinh
Copy link

anyone?

@llevkin
Copy link
Author

llevkin commented Mar 25, 2013

nobody cares... =)

@jcrugzz
Copy link
Contributor

jcrugzz commented Mar 25, 2013

Hey guys, we are currently in the process of testing node 0.10.x on our platform. Sometimes the newest versions have some kinks that need to be worked out when our whole system is built on node :). A patch with tests would of course be welcome though!

@desunit
Copy link

desunit commented Apr 2, 2013

@jcrugzz is the issue reproducible for you? I have found the same problem.

@indexzero
Copy link
Member

Lets call it an issue; someone want to submit a PR?

@pkarc
Copy link
Contributor

pkarc commented Apr 7, 2013

It seems it's related to this prev issue:
#97

@indexzero
Copy link
Member

Fixed in #402

@glasser
Copy link
Contributor

glasser commented Apr 22, 2013

@indexzero Can you reopen the issue at least, since the fix is buggy as described in #402 (comment) ? (It sometimes double-sends the first chunk of the post-headers part of the proxied websocket data). I know that you said you're planning to do a full rewrite of this code for the 0.10 API but it might be worth keeping open the record of the fact that the current code is buggy...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants