Skip to content

Commit

Permalink
[api] add close event in ws-incoming.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jleal52 authored and jcrugzz committed Dec 17, 2014
1 parent f92a1b6 commit 2653786
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/http-proxy/passes/ws-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ var passes = exports;

proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
proxySocket.on('error', onOutgoingError);

// Allow us to listen when the websocket has completed
proxySocket.on('end', function () {
server.emit('close', proxyRes, proxySocket, proxyHead);
});

// The pipe below will end proxySocket if socket closes cleanly, but not
// if it errors (eg, vanishes from the net and starts returning
// EHOSTUNREACH). We need to do that explicitly.
Expand Down

0 comments on commit 2653786

Please sign in to comment.