Skip to content
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

WSS connections are broken on node v0.9.9 #159

Closed
TooTallNate opened this issue Feb 6, 2013 · 5 comments
Closed

WSS connections are broken on node v0.9.9 #159

TooTallNate opened this issue Feb 6, 2013 · 5 comments

Comments

@TooTallNate
Copy link
Contributor

Repro:

var WebSocket = require('./');
var socket = new WebSocket('wss://echo.websocket.org');

socket.on('open', function () {
  console.error('socket "open" event');
  socket.send('hello world');
});
socket.on('message', function (data) {
  console.error('socket "message" event: %j', data);
});
socket.on('close', function () {
  console.error('socket "close" event');
});

Using the node v0.9.8 tagged version, things work as expected:

~/ws (master) ∴ node s.js 
socket "open" event
socket "message" event: "hello world"
# node remains running after this point

But after this commit (nodejs/node-v0.x-archive@d59beb9) this is the result I get:

~/ws (master) ∴ ~/node/node s
socket "open" event
socket "close" event

/cc @indutny @einaros

@einaros
Copy link
Contributor

einaros commented Feb 6, 2013

Will look into this in the morning. Thanks for reporting!

@TooTallNate
Copy link
Contributor Author

Thanks @einaros. P.S. the bug is more likely going to be in the tls module, rather than in ws itself, but I'm reporting it here first so that hopefully we can narrow down exactly what the problem is before bugging upstream.

@isaacs
Copy link

isaacs commented Feb 7, 2013

Putting off 0.9.9 release for this issue.

@einaros If you have any insights into what specifically changed in the interface to cause this, please let me know. Please do not simply work around it, even if it's trivial or easy to do so! It'll break someone else, as well, I'm sure.

My morning is quite a bit later than yours, so if you find anything, I'll see it in the morning, and make sure the fix gets into the 0.9.9 release.

Thanks!

@indutny
Copy link

indutny commented Feb 7, 2013

Found the source of problem, I guess StringDecoder/Encoder in streams2 does something incorrectly. Basically, ws is doing odd-job here by calling: .write(new Buffer(...), 'binary', cb), and resulting bytes are not the same bytes that was.

See nodejs/node-v0.x-archive#4727

/cc @isaacs @TooTallNate

@isaacs
Copy link

isaacs commented Feb 7, 2013

This is fixed in node 0.9.9

@einaros einaros closed this as completed Mar 31, 2013
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

4 participants