Skip to content

Commit 2653786

Browse files
jleal52jcrugzz
authored andcommitted
[api] add close event in ws-incoming.js
1 parent f92a1b6 commit 2653786

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/http-proxy/passes/ws-incoming.js

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ var passes = exports;
9696

9797
proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
9898
proxySocket.on('error', onOutgoingError);
99+
100+
// Allow us to listen when the websocket has completed
101+
proxySocket.on('end', function () {
102+
server.emit('close', proxyRes, proxySocket, proxyHead);
103+
});
104+
99105
// The pipe below will end proxySocket if socket closes cleanly, but not
100106
// if it errors (eg, vanishes from the net and starts returning
101107
// EHOSTUNREACH). We need to do that explicitly.

0 commit comments

Comments
 (0)