Skip to content

Commit

Permalink
ensure backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
einaros committed Oct 25, 2011
1 parent 8a90bf5 commit a9f81a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions support/node-websocket-client/lib/websocket.js
Expand Up @@ -502,7 +502,7 @@ var WebSocket = function(url, proto, opts) {
}

var httpReq = http.request(opt, function() { });
httpReq.on('upgrade', (function() {
var upgradeHandler = (function() {
var data = undefined;

return function(req, s, head) {
Expand Down Expand Up @@ -597,7 +597,9 @@ var WebSocket = function(url, proto, opts) {

stream.emit('data', head);
};
})());
})();
agent.on('upgrade', upgradeHandler); // node v0.4
httpReq.on('upgrade', upgradeHandler); // node v0.5+

httpReq.write(challenge, 'binary');
httpReq.end();
Expand Down

0 comments on commit a9f81a5

Please sign in to comment.