File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ http.createServer(function (req, res) {
196
196
* ` error ` : The error event is emitted if the request to the target fail.
197
197
* ` proxyRes ` : This event is emitted if the request to the target got a response.
198
198
* ` proxySocket ` : This event is emitted once the proxy websocket was created and piped into the target websocket.
199
+ * ` close ` : This event is emitted once the proxy websocket was closed.
199
200
200
201
``` js
201
202
var httpProxy = require (' http-proxy' );
@@ -233,6 +234,14 @@ proxy.on('proxySocket', function (proxySocket) {
233
234
// listen for messages coming FROM the target here
234
235
proxySocket .on (' data' , hybiParseAndLogMessage);
235
236
});
237
+
238
+ //
239
+ // Listen for the `close` event on `proxy`.
240
+ //
241
+ proxy .on (' close' , function (req , socket , head ) {
242
+ // view disconnected websocket connections
243
+ console .log (' Client disconnected' );
244
+ });
236
245
```
237
246
238
247
#### Using HTTPS
You can’t perform that action at this time.
0 commit comments